From 97a5970b20e05a450ebde784970ba0283031b3a1 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Thu, 26 Sep 2024 18:01:38 +0200 Subject: [PATCH 01/47] Initial working commit without tests Signed-off-by: Andrei de la Cruz --- .release-please-manifest.json | 3 +- DotnetSdkContrib.sln | 14 ++ ...Feature.Contrib.Providers.Flagsmith.csproj | 4 + .../FliptClientWrapper.cs | 120 ++++++++++++++++++ .../FliptProvider.cs | 72 +++++++++++ ...OpenFeature.Contrib.Providers.Flipt.csproj | 12 ++ .../version.txt | 1 + ...eature.Contrib.Providers.Flipt.Test.csproj | 24 ++++ 8 files changed, 249 insertions(+), 1 deletion(-) create mode 100644 src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs create mode 100644 src/OpenFeature.Contrib.Providers.Flipt/FliptProvider.cs create mode 100644 src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj create mode 100644 src/OpenFeature.Contrib.Providers.Flipt/version.txt create mode 100644 test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 42060071..60e3503a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -5,5 +5,6 @@ "src/OpenFeature.Contrib.Providers.Flagsmith": "0.2.0", "src/OpenFeature.Contrib.Providers.ConfigCat": "0.1.1", "src/OpenFeature.Contrib.Providers.FeatureManagement": "0.1.0", - "src/OpenFeature.Contrib.Providers.Statsig": "0.1.0" + "src/OpenFeature.Contrib.Providers.Statsig": "0.1.0", + "src/OpenFeature.Contrib.Providers.Flipt": "0.0.1" } \ No newline at end of file diff --git a/DotnetSdkContrib.sln b/DotnetSdkContrib.sln index 2c8566d1..57004386 100644 --- a/DotnetSdkContrib.sln +++ b/DotnetSdkContrib.sln @@ -41,6 +41,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenFeature.Contrib.Provide EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenFeature.Contrib.Providers.Statsig.Test", "test\OpenFeature.Contrib.Providers.Statsig.Test\OpenFeature.Contrib.Providers.Statsig.Test.csproj", "{F3080350-B0AB-4D59-B416-50CC38C99087}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenFeature.Contrib.Providers.Flipt", "src\OpenFeature.Contrib.Providers.Flipt\OpenFeature.Contrib.Providers.Flipt.csproj", "{5ECF7DBF-FE64-40A2-BF39-239DE173DA4B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenFeature.Contrib.Providers.Flipt.Test", "test\OpenFeature.Contrib.Providers.Flipt.Test\OpenFeature.Contrib.Providers.Flipt.Test.csproj", "{B446D481-B5A3-4509-8933-C4CF6DA9B147}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -115,6 +119,14 @@ Global {F3080350-B0AB-4D59-B416-50CC38C99087}.Debug|Any CPU.Build.0 = Debug|Any CPU {F3080350-B0AB-4D59-B416-50CC38C99087}.Release|Any CPU.ActiveCfg = Release|Any CPU {F3080350-B0AB-4D59-B416-50CC38C99087}.Release|Any CPU.Build.0 = Release|Any CPU + {5ECF7DBF-FE64-40A2-BF39-239DE173DA4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5ECF7DBF-FE64-40A2-BF39-239DE173DA4B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5ECF7DBF-FE64-40A2-BF39-239DE173DA4B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5ECF7DBF-FE64-40A2-BF39-239DE173DA4B}.Release|Any CPU.Build.0 = Release|Any CPU + {B446D481-B5A3-4509-8933-C4CF6DA9B147}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B446D481-B5A3-4509-8933-C4CF6DA9B147}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B446D481-B5A3-4509-8933-C4CF6DA9B147}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B446D481-B5A3-4509-8933-C4CF6DA9B147}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -137,5 +149,7 @@ Global {B8C5376B-BAFE-48B8-ABC1-111A93C033F2} = {B6D3230B-5E4D-4FF1-868E-2F4E325C84FE} {4C7C0E2D-6ECC-4D17-BC5D-18F6BA6F872A} = {0E563821-BD08-4B7F-BF9D-395CAD80F026} {F3080350-B0AB-4D59-B416-50CC38C99087} = {B6D3230B-5E4D-4FF1-868E-2F4E325C84FE} + {5ECF7DBF-FE64-40A2-BF39-239DE173DA4B} = {0E563821-BD08-4B7F-BF9D-395CAD80F026} + {B446D481-B5A3-4509-8933-C4CF6DA9B147} = {B6D3230B-5E4D-4FF1-868E-2F4E325C84FE} EndGlobalSection EndGlobal diff --git a/src/OpenFeature.Contrib.Providers.Flagsmith/OpenFeature.Contrib.Providers.Flagsmith.csproj b/src/OpenFeature.Contrib.Providers.Flagsmith/OpenFeature.Contrib.Providers.Flagsmith.csproj index 73234f32..38e8c260 100644 --- a/src/OpenFeature.Contrib.Providers.Flagsmith/OpenFeature.Contrib.Providers.Flagsmith.csproj +++ b/src/OpenFeature.Contrib.Providers.Flagsmith/OpenFeature.Contrib.Providers.Flagsmith.csproj @@ -25,6 +25,10 @@ + + + + latest diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs new file mode 100644 index 00000000..76a270df --- /dev/null +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs @@ -0,0 +1,120 @@ +using System; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Flipt.Authentication; +using Flipt.Clients; +using Flipt.DTOs; +using Flipt.Utilities; +using OpenFeature.Constant; +using OpenFeature.Model; + +namespace OpenFeature.Contrib.Providers.Flipt; + +public class FliptClientWrapper : IFliptClientWrapper +{ + private readonly Evaluation _fliptEvaluationClient; + private readonly string _namespaceKey; + + /// + /// Wrapper that uses Flipt to OpenFeature compliant models + /// + /// Url of flipt instance + /// Namespace used for querying flags + /// Authentication access token + /// Timeout when calling flipt endpoints in seconds + public FliptClientWrapper(string fliptUrl, + string namespaceKey = "default", + string clientToken = "", + int timeoutInSeconds = 30) + { + _fliptEvaluationClient = BuildClient(fliptUrl, clientToken, timeoutInSeconds).Evaluation; + _namespaceKey = namespaceKey; + } + + /// + public async Task> EvaluateAsync(string flagKey, T defaultValue, EvaluationContext context) + { + var evaluationRequest = new EvaluationRequest(_namespaceKey, flagKey, context?.TargetingKey ?? "", + context?.AsDictionary().ToDictionary(k => k.Key, v => JsonSerializer.Serialize(v.Value)) ?? []); + + try + { + var evaluationResponse = await _fliptEvaluationClient.EvaluateVariantAsync(evaluationRequest); + if (!(evaluationResponse?.Match ?? false)) + return new ResolutionDetails(flagKey, defaultValue, ErrorType.General); + + try + { + return new ResolutionDetails(flagKey, + (T)Convert.ChangeType(evaluationResponse.VariantKey, typeof(T))); + } + catch (InvalidCastException ex) + { + return new ResolutionDetails(flagKey, defaultValue, ErrorType.TypeMismatch); + } + } + catch (HttpRequestException e) + { + return e.StatusCode == HttpStatusCode.NotFound + ? new ResolutionDetails(flagKey, defaultValue, ErrorType.FlagNotFound) + : new ResolutionDetails(flagKey, defaultValue, ErrorType.General); + } + } + + /// + public async Task> EvaluateBooleanAsync(string flagKey, bool defaultValue, + EvaluationContext context) + { + var evaluationRequest = new EvaluationRequest(_namespaceKey, flagKey, context?.TargetingKey ?? "", + context?.AsDictionary().ToDictionary(k => k.Key, v => JsonSerializer.Serialize(v.Value)) ?? []); + + try + { + var boolEvaluationResponse = await _fliptEvaluationClient.EvaluateBooleanAsync(evaluationRequest); + return new ResolutionDetails(flagKey, boolEvaluationResponse?.Enabled ?? defaultValue); + } + catch (HttpRequestException e) + { + return e.StatusCode == HttpStatusCode.NotFound + ? new ResolutionDetails(flagKey, defaultValue, ErrorType.FlagNotFound) + : new ResolutionDetails(flagKey, defaultValue, ErrorType.General); + } + } + + private static FliptClient BuildClient(string fliptUrl, string clientToken, int timeoutInSeconds = 30) + { + return FliptClient.Builder() + .WithUrl(fliptUrl) + .WithAuthentication(new ClientTokenAuthenticationStrategy(clientToken)) + .WithTimeout(timeoutInSeconds) + .Build(); + } +} + +/// +/// Contract for fliptClient wrapper +/// +public interface IFliptClientWrapper +{ + /// + /// Used for evaluating non-boolean flags. Flipt handles datatypes which is not boolean as variants + /// + /// + /// + /// + /// + /// OpenFeature ResolutionDetails object + Task> EvaluateAsync(string flagKey, T defaultValue, EvaluationContext context); + + /// + /// Used for evaluating boolean flags + /// + /// + /// + /// + /// OpenFeature ResolutionDetails object + Task> EvaluateBooleanAsync(string flagKey, bool defaultValue, EvaluationContext context); +} \ No newline at end of file diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptProvider.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptProvider.cs new file mode 100644 index 00000000..c24ed128 --- /dev/null +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptProvider.cs @@ -0,0 +1,72 @@ +using System.Threading; +using System.Threading.Tasks; +using OpenFeature.Model; + +namespace OpenFeature.Contrib.Providers.Flipt; + +/// +/// FliptProvider is the .NET provider implementation for Flipt.io +/// +/// +/// +/// Url of flipt instance +/// Namespace used for querying flags +/// Authentication access token +/// Timeout when calling flipt endpoints in seconds +public class FliptProvider( + string fliptUrl, + string namespaceKey = "default", + string clientToken = "", + int timeoutInSeconds = 30) : FeatureProvider +{ + private static readonly Metadata Metadata = new("Flipt Provider"); + + private readonly IFliptClientWrapper _fliptClientWrapper = + new FliptClientWrapper(fliptUrl, namespaceKey, clientToken, timeoutInSeconds); + + /// + public override Metadata GetMetadata() + { + return Metadata; + } + + /// + public override async Task> ResolveBooleanValueAsync(string flagKey, bool defaultValue, + EvaluationContext context = null, + CancellationToken cancellationToken = new()) + { + return await _fliptClientWrapper.EvaluateBooleanAsync(flagKey, defaultValue, context); + } + + /// + public override async Task> ResolveStringValueAsync(string flagKey, + string defaultValue, EvaluationContext context = null, + CancellationToken cancellationToken = new()) + { + return await _fliptClientWrapper.EvaluateAsync(flagKey, defaultValue, context); + } + + /// + public override async Task> ResolveIntegerValueAsync(string flagKey, int defaultValue, + EvaluationContext context = null, + CancellationToken cancellationToken = new()) + { + return await _fliptClientWrapper.EvaluateAsync(flagKey, defaultValue, context); + } + + /// + public override async Task> ResolveDoubleValueAsync(string flagKey, double defaultValue, + EvaluationContext context = null, + CancellationToken cancellationToken = new()) + { + return await _fliptClientWrapper.EvaluateAsync(flagKey, defaultValue, context); + } + + /// + public override async Task> ResolveStructureValueAsync(string flagKey, Value defaultValue, + EvaluationContext context = null, + CancellationToken cancellationToken = new()) + { + return await _fliptClientWrapper.EvaluateAsync(flagKey, defaultValue, context); + } +} \ No newline at end of file diff --git a/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj b/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj new file mode 100644 index 00000000..a388c868 --- /dev/null +++ b/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj @@ -0,0 +1,12 @@ + + + + net8.0 + default + + + + + + + diff --git a/src/OpenFeature.Contrib.Providers.Flipt/version.txt b/src/OpenFeature.Contrib.Providers.Flipt/version.txt new file mode 100644 index 00000000..8a9ecc2e --- /dev/null +++ b/src/OpenFeature.Contrib.Providers.Flipt/version.txt @@ -0,0 +1 @@ +0.0.1 \ No newline at end of file diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj b/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj new file mode 100644 index 00000000..010f7437 --- /dev/null +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj @@ -0,0 +1,24 @@ + + + + net8.0 + enable + enable + + false + true + latest + + + + + + + + + + + + + + From c707b3ecc09e6657e60d8da06a81b2c644f1e20f Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Fri, 27 Sep 2024 13:19:52 +0200 Subject: [PATCH 02/47] FliptProvider: Handle type mismatch and Value casting Signed-off-by: Andrei de la Cruz --- .../FliptClientWrapper.cs | 24 +++++++++++++++---- .../README.md | 0 2 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 src/OpenFeature.Contrib.Providers.Flipt/README.md diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs index 76a270df..6d5db1cc 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs @@ -13,6 +13,9 @@ namespace OpenFeature.Contrib.Providers.Flipt; +/// +/// A wrapper of fliptClient to handle data casting and error mappings to OpenFeature models +/// public class FliptClientWrapper : IFliptClientWrapper { private readonly Evaluation _fliptEvaluationClient; @@ -44,14 +47,26 @@ public async Task> EvaluateAsync(string flagKey, T defau { var evaluationResponse = await _fliptEvaluationClient.EvaluateVariantAsync(evaluationRequest); if (!(evaluationResponse?.Match ?? false)) - return new ResolutionDetails(flagKey, defaultValue, ErrorType.General); + return new ResolutionDetails(flagKey, defaultValue, ErrorType.None, + evaluationResponse?.Reason.ToString()); try { + var convertedValue = (T)Convert.ChangeType(evaluationResponse.VariantKey, typeof(T)); return new ResolutionDetails(flagKey, - (T)Convert.ChangeType(evaluationResponse.VariantKey, typeof(T))); + convertedValue, ErrorType.None, + evaluationResponse.Reason.ToString()); + } + catch (InvalidCastException) + { + // cannot change type if of type Value + if (typeof(T) == typeof(Value)) + return new ResolutionDetails(flagKey, + (T)Convert.ChangeType(new Value(evaluationResponse.VariantAttachment), typeof(T)), + ErrorType.None, evaluationResponse.Reason.ToString()); + return new ResolutionDetails(flagKey, defaultValue, ErrorType.TypeMismatch); } - catch (InvalidCastException ex) + catch (FormatException) { return new ResolutionDetails(flagKey, defaultValue, ErrorType.TypeMismatch); } @@ -74,7 +89,8 @@ public async Task> EvaluateBooleanAsync(string flagKey, try { var boolEvaluationResponse = await _fliptEvaluationClient.EvaluateBooleanAsync(evaluationRequest); - return new ResolutionDetails(flagKey, boolEvaluationResponse?.Enabled ?? defaultValue); + return new ResolutionDetails(flagKey, boolEvaluationResponse?.Enabled ?? defaultValue, ErrorType.None, + boolEvaluationResponse?.Reason.ToString()); } catch (HttpRequestException e) { diff --git a/src/OpenFeature.Contrib.Providers.Flipt/README.md b/src/OpenFeature.Contrib.Providers.Flipt/README.md new file mode 100644 index 00000000..e69de29b From ee902c625368232356d30ab08ca3d267b9e6afc9 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Fri, 27 Sep 2024 15:06:02 +0200 Subject: [PATCH 03/47] FliptProvider: Added extension to map flipt context to openFeature, added handling of http exceptions thrown by flipt client Signed-off-by: Andrei de la Cruz --- .../FliptClientWrapper.cs | 25 +++++++++++-------- .../FliptExtensions.cs | 14 +++++++++++ 2 files changed, 29 insertions(+), 10 deletions(-) create mode 100644 src/OpenFeature.Contrib.Providers.Flipt/FliptExtensions.cs diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs index 6d5db1cc..dadb244d 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs @@ -1,8 +1,6 @@ using System; -using System.Linq; using System.Net; using System.Net.Http; -using System.Text.Json; using System.Threading.Tasks; using Flipt.Authentication; using Flipt.Clients; @@ -41,7 +39,7 @@ public FliptClientWrapper(string fliptUrl, public async Task> EvaluateAsync(string flagKey, T defaultValue, EvaluationContext context) { var evaluationRequest = new EvaluationRequest(_namespaceKey, flagKey, context?.TargetingKey ?? "", - context?.AsDictionary().ToDictionary(k => k.Key, v => JsonSerializer.Serialize(v.Value)) ?? []); + context.ToStringDictionary()); try { @@ -73,9 +71,7 @@ public async Task> EvaluateAsync(string flagKey, T defau } catch (HttpRequestException e) { - return e.StatusCode == HttpStatusCode.NotFound - ? new ResolutionDetails(flagKey, defaultValue, ErrorType.FlagNotFound) - : new ResolutionDetails(flagKey, defaultValue, ErrorType.General); + return HandleRequestException(e, flagKey, defaultValue); } } @@ -84,7 +80,7 @@ public async Task> EvaluateBooleanAsync(string flagKey, EvaluationContext context) { var evaluationRequest = new EvaluationRequest(_namespaceKey, flagKey, context?.TargetingKey ?? "", - context?.AsDictionary().ToDictionary(k => k.Key, v => JsonSerializer.Serialize(v.Value)) ?? []); + context.ToStringDictionary()); try { @@ -94,12 +90,21 @@ public async Task> EvaluateBooleanAsync(string flagKey, } catch (HttpRequestException e) { - return e.StatusCode == HttpStatusCode.NotFound - ? new ResolutionDetails(flagKey, defaultValue, ErrorType.FlagNotFound) - : new ResolutionDetails(flagKey, defaultValue, ErrorType.General); + return HandleRequestException(e, flagKey, defaultValue); } } + private ResolutionDetails HandleRequestException(HttpRequestException e, string flagKey, T defaultValue) + { + var error = e.StatusCode switch + { + HttpStatusCode.NotFound => ErrorType.FlagNotFound, + HttpStatusCode.BadRequest => ErrorType.TypeMismatch, + _ => ErrorType.General + }; + return new ResolutionDetails(flagKey, defaultValue, error, errorMessage: e.Message); + } + private static FliptClient BuildClient(string fliptUrl, string clientToken, int timeoutInSeconds = 30) { return FliptClient.Builder() diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptExtensions.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptExtensions.cs new file mode 100644 index 00000000..f30785cd --- /dev/null +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptExtensions.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; +using OpenFeature.Model; + +namespace OpenFeature.Contrib.Providers.Flipt; + +public static class FliptExtensions +{ + public static Dictionary ToStringDictionary(this EvaluationContext evaluationContext) + { + return evaluationContext?.AsDictionary().ToDictionary(k => k.Key, v => JsonSerializer.Serialize(v.Value)) ?? []; + } +} \ No newline at end of file From 656711bb6db04e6d79abb0e61d2452c30e303b62 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Fri, 27 Sep 2024 15:56:39 +0200 Subject: [PATCH 04/47] Added xmldoc on extension function Signed-off-by: Andrei de la Cruz --- src/OpenFeature.Contrib.Providers.Flipt/FliptExtensions.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptExtensions.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptExtensions.cs index f30785cd..80ca2ab5 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/FliptExtensions.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptExtensions.cs @@ -7,6 +7,11 @@ namespace OpenFeature.Contrib.Providers.Flipt; public static class FliptExtensions { + /// + /// Transforms openFeature EvaluationContext to a mutable Dictionary that flipt sdk accepts + /// + /// OpenFeature EvaluationContext + /// public static Dictionary ToStringDictionary(this EvaluationContext evaluationContext) { return evaluationContext?.AsDictionary().ToDictionary(k => k.Key, v => JsonSerializer.Serialize(v.Value)) ?? []; From f17949b47c2190b6937a7bc887a36f7d1d475d3a Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Fri, 27 Sep 2024 17:46:55 +0200 Subject: [PATCH 05/47] Added handling of different Value types, added tests to check for proper serialization to Dict Signed-off-by: Andrei de la Cruz --- .../Converters/OpenFeatureValueConverter.cs | 63 ++++++++++ .../FliptExtensions.cs | 16 ++- .../FlipExtensionsTest.cs | 114 ++++++++++++++++++ .../FliptClientWrapperTest.cs | 6 + .../FliptProviderTest.cs | 6 + ...eature.Contrib.Providers.Flipt.Test.csproj | 5 + 6 files changed, 209 insertions(+), 1 deletion(-) create mode 100644 src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureValueConverter.cs create mode 100644 test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs create mode 100644 test/OpenFeature.Contrib.Providers.Flipt.Test/FliptClientWrapperTest.cs create mode 100644 test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs diff --git a/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureValueConverter.cs b/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureValueConverter.cs new file mode 100644 index 00000000..7f1c963a --- /dev/null +++ b/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureValueConverter.cs @@ -0,0 +1,63 @@ +using System; +using System.Text.Json; +using System.Text.Json.Serialization; +using OpenFeature.Model; + +namespace OpenFeature.Contrib.Providers.Flipt.Converters; + +public class OpenFeatureValueConverter : JsonConverter +{ + public override Value Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var value = new Value(); + switch (reader.TokenType) + { + case JsonTokenType.String: + return reader.TryGetDateTime(out var dateTimeValue) + ? new Value(dateTimeValue) + : new Value(reader.GetString() ?? string.Empty); + case JsonTokenType.True: + case JsonTokenType.False: + return new Value(reader.GetBoolean()); + case JsonTokenType.Number: + if (reader.TryGetInt32(out var intValue)) return new Value(intValue); + if (reader.TryGetDouble(out var dblValue)) return new Value(dblValue); + break; + case JsonTokenType.Null: + case JsonTokenType.None: + case JsonTokenType.StartObject: + case JsonTokenType.EndObject: + case JsonTokenType.StartArray: + case JsonTokenType.EndArray: + case JsonTokenType.PropertyName: + case JsonTokenType.Comment: + default: + break; + } + + return value; + } + + public override void Write(Utf8JsonWriter writer, Value value, JsonSerializerOptions options) + { + writer.WriteRawValue(JsonSerializer.Serialize(value.AsObject)); + } +} + +public class StructureConverter : JsonConverter +{ + public override Structure Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + throw new NotImplementedException(); + } + + public override void Write(Utf8JsonWriter writer, Structure value, JsonSerializerOptions options) + { + var serializeOptions = new JsonSerializerOptions + { + WriteIndented = true, + Converters = { new OpenFeatureValueConverter() } + }; + writer.WriteRawValue(JsonSerializer.Serialize(value.AsDictionary(), serializeOptions)); + } +} \ No newline at end of file diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptExtensions.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptExtensions.cs index 80ca2ab5..bdfd6bd9 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/FliptExtensions.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptExtensions.cs @@ -1,10 +1,14 @@ using System.Collections.Generic; using System.Linq; using System.Text.Json; +using OpenFeature.Contrib.Providers.Flipt.Converters; using OpenFeature.Model; namespace OpenFeature.Contrib.Providers.Flipt; +/// +/// Extension helper methods +/// public static class FliptExtensions { /// @@ -14,6 +18,16 @@ public static class FliptExtensions /// public static Dictionary ToStringDictionary(this EvaluationContext evaluationContext) { - return evaluationContext?.AsDictionary().ToDictionary(k => k.Key, v => JsonSerializer.Serialize(v.Value)) ?? []; + var serializeOptions = new JsonSerializerOptions + { + WriteIndented = true, + Converters = + { + new OpenFeatureValueConverter(), + new StructureConverter() + } + }; + return evaluationContext?.AsDictionary() + .ToDictionary(k => k.Key, v => JsonSerializer.Serialize(v.Value.AsObject, serializeOptions)) ?? []; } } \ No newline at end of file diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs new file mode 100644 index 00000000..0f8d632a --- /dev/null +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs @@ -0,0 +1,114 @@ +using System.Text.Json; +using FluentAssertions; +using OpenFeature.Contrib.Providers.Flipt.Converters; +using OpenFeature.Model; + +namespace OpenFeature.Contrib.Providers.Flipt.Test; + +public class FlipExtensionsTest +{ + [Fact] + public void ToStringDictionary_WithEmptyContext_ShouldReturnEmptyDictionary() + { + var evaluationContext = EvaluationContext.Builder().Build(); + var result = evaluationContext.ToStringDictionary(); + + result.Should().NotBeNull(); + result.Should().BeEmpty(); + } + + [Fact] + public void ToStringDictionary_WithContext_ShouldReturnADictionaryWithValues() + { + var evaluationContext = EvaluationContext.Builder() + .SetTargetingKey(Guid.NewGuid().ToString()) + .Set("location", "somewhere") + .Build(); + var result = evaluationContext.ToStringDictionary(); + + result.Should().NotBeNull(); + result.Should().NotBeEmpty(); + result.Keys.Should().Contain("location"); + } + + [Fact] + public void ToStringDictionary_WithContextAndIntegerValue_ShouldReturnADictionaryWithStringValues() + { + var evaluationContext = EvaluationContext.Builder() + .SetTargetingKey(Guid.NewGuid().ToString()) + .Set("age", 23) + .Build(); + var result = evaluationContext.ToStringDictionary(); + + result.Should().NotBeNull(); + result.Should().NotBeEmpty(); + result.Keys.Should().Contain("age"); + result["age"].Should().Be("23"); + } + + [Fact] + public void ToStringDictionary_WithContextAndValuesOfStrings_ShouldReturnADictionaryWithSerializedStringValues() + { + var testStructure = new Structure(new Dictionary + { + { "config1", new Value("value1") }, + { "config2", new Value("value2") } + }); + + var evaluationContext = EvaluationContext.Builder() + .SetTargetingKey(Guid.NewGuid().ToString()) + .Set("config", testStructure) + .Build(); + var result = evaluationContext.ToStringDictionary(); + + result.Should().NotBeNull(); + result.Should().NotBeEmpty(); + result.Keys.Should().Contain("config"); + + var serializeOptions = new JsonSerializerOptions + { + WriteIndented = true, + Converters = + { + new OpenFeatureValueConverter() + } + }; + + JsonSerializer.Deserialize>(result["config"], serializeOptions).Should() + .BeEquivalentTo(testStructure); + } + + [Fact] + public void ToStringDictionary_WithContextAndMixedValueTypes_ShouldReturnADictionaryWithSerializedValues() + { + var testStructure = new Structure(new Dictionary + { + { "config1", new Value(1) }, + { "config2", new Value("value2") }, + { "config3", new Value(DateTime.Now) } + }); + + var evaluationContext = EvaluationContext.Builder() + .SetTargetingKey(Guid.NewGuid().ToString()) + .Set("config", testStructure) + .Build(); + var result = evaluationContext.ToStringDictionary(); + + result.Should().NotBeNull(); + result.Should().NotBeEmpty(); + result.Keys.Should().Contain("config"); + + var serializeOptions = new JsonSerializerOptions + { + WriteIndented = true, + Converters = + { + new OpenFeatureValueConverter() + } + }; + + var deserialized = JsonSerializer.Deserialize>(result["config"], serializeOptions); + deserialized.Should() + .BeEquivalentTo(testStructure); + } +} \ No newline at end of file diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptClientWrapperTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptClientWrapperTest.cs new file mode 100644 index 00000000..b406ad58 --- /dev/null +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptClientWrapperTest.cs @@ -0,0 +1,6 @@ +namespace OpenFeature.Contrib.Providers.Flipt.Test; + +public class FliptClientWrapperTest +{ + +} \ No newline at end of file diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs new file mode 100644 index 00000000..f2c1ca06 --- /dev/null +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs @@ -0,0 +1,6 @@ +namespace OpenFeature.Contrib.Providers.Flipt.Test; + +public class FliptProviderTest +{ + +} \ No newline at end of file diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj b/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj index 010f7437..89986460 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj @@ -15,10 +15,15 @@ + + + + + From 7898c86f46d142c02445e49e6704c4c2d5c5a881 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Fri, 27 Sep 2024 18:36:07 +0200 Subject: [PATCH 06/47] Added handling of array of Values, introduced universal deserializer JSON settings Signed-off-by: Andrei de la Cruz --- .../Converters/JsonConverterExtensions.cs | 19 ++++++ .../OpenFeatureStructureConverter.cs | 29 +++++++++ .../Converters/OpenFeatureValueConverter.cs | 62 ++++++++++++------- .../FliptExtensions.cs | 14 ++--- .../FlipExtensionsTest.cs | 56 ++++++++++------- 5 files changed, 125 insertions(+), 55 deletions(-) create mode 100644 src/OpenFeature.Contrib.Providers.Flipt/Converters/JsonConverterExtensions.cs create mode 100644 src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureStructureConverter.cs diff --git a/src/OpenFeature.Contrib.Providers.Flipt/Converters/JsonConverterExtensions.cs b/src/OpenFeature.Contrib.Providers.Flipt/Converters/JsonConverterExtensions.cs new file mode 100644 index 00000000..0f1579cd --- /dev/null +++ b/src/OpenFeature.Contrib.Providers.Flipt/Converters/JsonConverterExtensions.cs @@ -0,0 +1,19 @@ +using System.Text.Json; + +namespace OpenFeature.Contrib.Providers.Flipt.Converters; + +/// +/// Extensions for default JsonConverter behavior +/// +public static class JsonConverterExtensions +{ + public static readonly JsonSerializerOptions DefaultSerializerSettings = new() + { + WriteIndented = true, + Converters = + { + new OpenFeatureStructureConverter(), + new OpenFeatureValueConverter() + } + }; +} \ No newline at end of file diff --git a/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureStructureConverter.cs b/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureStructureConverter.cs new file mode 100644 index 00000000..0b30565e --- /dev/null +++ b/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureStructureConverter.cs @@ -0,0 +1,29 @@ +using System; +using System.Text.Json; +using System.Text.Json.Serialization; +using OpenFeature.Model; + +namespace OpenFeature.Contrib.Providers.Flipt.Converters; + +/// +/// JsonConverter for OpenFeature Structure type +/// +public class OpenFeatureStructureConverter : JsonConverter +{ + /// + public override Structure Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + throw new NotImplementedException(); + } + + /// + public override void Write(Utf8JsonWriter writer, Structure value, JsonSerializerOptions options) + { + var serializeOptions = new JsonSerializerOptions + { + WriteIndented = true, + Converters = { new OpenFeatureValueConverter() } + }; + writer.WriteRawValue(JsonSerializer.Serialize(value.AsDictionary(), serializeOptions)); + } +} \ No newline at end of file diff --git a/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureValueConverter.cs b/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureValueConverter.cs index 7f1c963a..1c723432 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureValueConverter.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureValueConverter.cs @@ -1,12 +1,17 @@ using System; +using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; using OpenFeature.Model; namespace OpenFeature.Contrib.Providers.Flipt.Converters; +/// +/// OpenFeature Value type converter +/// public class OpenFeatureValueConverter : JsonConverter { + /// public override Value Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { var value = new Value(); @@ -23,41 +28,50 @@ public override Value Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSe if (reader.TryGetInt32(out var intValue)) return new Value(intValue); if (reader.TryGetDouble(out var dblValue)) return new Value(dblValue); break; - case JsonTokenType.Null: - case JsonTokenType.None: - case JsonTokenType.StartObject: - case JsonTokenType.EndObject: case JsonTokenType.StartArray: - case JsonTokenType.EndArray: - case JsonTokenType.PropertyName: - case JsonTokenType.Comment: - default: - break; + return new Value(GenerateValueArray(ref reader, typeToConvert, options)); } return value; } - public override void Write(Utf8JsonWriter writer, Value value, JsonSerializerOptions options) + private IList GenerateValueArray(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { - writer.WriteRawValue(JsonSerializer.Serialize(value.AsObject)); - } -} + var valuesArray = new List(); + var val = new Value(); + var startDepth = reader.CurrentDepth; -public class StructureConverter : JsonConverter -{ - public override Structure Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - throw new NotImplementedException(); + while (reader.Read()) + switch (reader.TokenType) + { + case JsonTokenType.EndArray when reader.CurrentDepth == startDepth: + return valuesArray; + case JsonTokenType.StartObject: + val = new Value(); + break; + case JsonTokenType.EndObject: + valuesArray.Add(val); + break; + default: + valuesArray.Add(Read(ref reader, typeToConvert, options)); + break; + } + + return valuesArray; } - public override void Write(Utf8JsonWriter writer, Structure value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, Value value, JsonSerializerOptions options) { - var serializeOptions = new JsonSerializerOptions + if (value.IsList) { - WriteIndented = true, - Converters = { new OpenFeatureValueConverter() } - }; - writer.WriteRawValue(JsonSerializer.Serialize(value.AsDictionary(), serializeOptions)); + writer.WriteStartArray(); + foreach (var val in value.AsList!) writer.WriteRawValue(JsonSerializer.Serialize(val.AsObject)); + writer.WriteEndArray(); + } + else + { + writer.WriteRawValue(JsonSerializer.Serialize(value.AsObject)); + } } } \ No newline at end of file diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptExtensions.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptExtensions.cs index bdfd6bd9..9f503533 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/FliptExtensions.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptExtensions.cs @@ -18,16 +18,10 @@ public static class FliptExtensions /// public static Dictionary ToStringDictionary(this EvaluationContext evaluationContext) { - var serializeOptions = new JsonSerializerOptions - { - WriteIndented = true, - Converters = - { - new OpenFeatureValueConverter(), - new StructureConverter() - } - }; return evaluationContext?.AsDictionary() - .ToDictionary(k => k.Key, v => JsonSerializer.Serialize(v.Value.AsObject, serializeOptions)) ?? []; + .ToDictionary(k => k.Key, + v => JsonSerializer.Serialize(v.Value.AsObject, + JsonConverterExtensions.DefaultSerializerSettings)) ?? + []; } } \ No newline at end of file diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs index 0f8d632a..88584f24 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs @@ -65,16 +65,9 @@ public void ToStringDictionary_WithContextAndValuesOfStrings_ShouldReturnADictio result.Should().NotBeEmpty(); result.Keys.Should().Contain("config"); - var serializeOptions = new JsonSerializerOptions - { - WriteIndented = true, - Converters = - { - new OpenFeatureValueConverter() - } - }; - - JsonSerializer.Deserialize>(result["config"], serializeOptions).Should() + JsonSerializer + .Deserialize>(result["config"], + JsonConverterExtensions.DefaultSerializerSettings).Should() .BeEquivalentTo(testStructure); } @@ -98,17 +91,38 @@ public void ToStringDictionary_WithContextAndMixedValueTypes_ShouldReturnADictio result.Should().NotBeEmpty(); result.Keys.Should().Contain("config"); - var serializeOptions = new JsonSerializerOptions + var deserialized = JsonSerializer.Deserialize>(result["config"], + JsonConverterExtensions.DefaultSerializerSettings); + deserialized.Should().BeEquivalentTo(testStructure); + } + + [Fact] + public void ToStringDictionary_WithContextAndWithList_ShouldReturnADictionaryWithSerializedValues() + { + var testStructure = new Structure(new Dictionary { - WriteIndented = true, - Converters = - { - new OpenFeatureValueConverter() - } - }; - - var deserialized = JsonSerializer.Deserialize>(result["config"], serializeOptions); - deserialized.Should() - .BeEquivalentTo(testStructure); + // { + // "config1", new Value(new Structure(new Dictionary + // { + // { "nested1", new Value(1) } + // })) + // }, + { "config2", new Value([new Value("element1"), new Value("element2"), new Value("element3")]) }, + { "config3", new Value(DateTime.Now) } + }); + + var evaluationContext = EvaluationContext.Builder() + .SetTargetingKey(Guid.NewGuid().ToString()) + .Set("config", testStructure) + .Build(); + var result = evaluationContext.ToStringDictionary(); + + result.Should().NotBeNull(); + result.Should().NotBeEmpty(); + result.Keys.Should().Contain("config"); + + var deserialized = JsonSerializer.Deserialize>(result["config"], + JsonConverterExtensions.DefaultSerializerSettings); + deserialized.Should().BeEquivalentTo(testStructure); } } \ No newline at end of file From 41cf5bf470dc03955d7bface22e81065615f3f5b Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Fri, 27 Sep 2024 18:42:38 +0200 Subject: [PATCH 07/47] Added support to serialize nested Values list Signed-off-by: Andrei de la Cruz --- .../Converters/OpenFeatureValueConverter.cs | 4 +++- .../FlipExtensionsTest.cs | 10 ++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureValueConverter.cs b/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureValueConverter.cs index 1c723432..2425d058 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureValueConverter.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureValueConverter.cs @@ -66,7 +66,9 @@ public override void Write(Utf8JsonWriter writer, Value value, JsonSerializerOpt if (value.IsList) { writer.WriteStartArray(); - foreach (var val in value.AsList!) writer.WriteRawValue(JsonSerializer.Serialize(val.AsObject)); + foreach (var val in value.AsList!) + writer.WriteRawValue(JsonSerializer.Serialize(val.AsObject, + JsonConverterExtensions.DefaultSerializerSettings)); writer.WriteEndArray(); } else diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs index 88584f24..cba94d16 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs @@ -97,7 +97,7 @@ public void ToStringDictionary_WithContextAndMixedValueTypes_ShouldReturnADictio } [Fact] - public void ToStringDictionary_WithContextAndWithList_ShouldReturnADictionaryWithSerializedValues() + public void ToStringDictionary_WithContextWithListAndNestedList_ShouldReturnADictionaryWithSerializedValues() { var testStructure = new Structure(new Dictionary { @@ -107,7 +107,13 @@ public void ToStringDictionary_WithContextAndWithList_ShouldReturnADictionaryWit // { "nested1", new Value(1) } // })) // }, - { "config2", new Value([new Value("element1"), new Value("element2"), new Value("element3")]) }, + { + "config2", + new Value([ + new Value([new Value("element1-1"), new Value("element1-2")]), new Value("element2"), + new Value("element3") + ]) + }, { "config3", new Value(DateTime.Now) } }); From d94a6c6a1bd728a05b13903abdc239de7c87d90e Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Fri, 27 Sep 2024 20:33:27 +0200 Subject: [PATCH 08/47] FliptProvider: Add support for serializing structure Signed-off-by: Andrei de la Cruz --- .../OpenFeatureStructureConverter.cs | 2 ++ .../Converters/OpenFeatureValueConverter.cs | 32 +++++++++++++---- .../FlipExtensionsTest.cs | 35 +++++++++++++++---- 3 files changed, 56 insertions(+), 13 deletions(-) diff --git a/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureStructureConverter.cs b/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureStructureConverter.cs index 0b30565e..78fa0f20 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureStructureConverter.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureStructureConverter.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; using OpenFeature.Model; @@ -13,6 +14,7 @@ public class OpenFeatureStructureConverter : JsonConverter /// public override Structure Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + var structure = new Structure(new Dictionary()); throw new NotImplementedException(); } diff --git a/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureValueConverter.cs b/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureValueConverter.cs index 2425d058..203dccc9 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureValueConverter.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureValueConverter.cs @@ -30,11 +30,34 @@ public override Value Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSe break; case JsonTokenType.StartArray: return new Value(GenerateValueArray(ref reader, typeToConvert, options)); + case JsonTokenType.StartObject: + return new Value(GetStructure(ref reader, typeToConvert, options)); } return value; } + private Structure GetStructure(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var startDepth = reader.CurrentDepth; + var structureDictionary = new Dictionary(); + while (reader.Read()) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + var key = reader.GetString(); + reader.Read(); + var val = Read(ref reader, typeToConvert, options); + structureDictionary[key ?? string.Empty] = val; + } + + if (reader.TokenType == JsonTokenType.EndObject && reader.CurrentDepth == startDepth) break; + } + + return new Structure(structureDictionary); + } + + private IList GenerateValueArray(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { @@ -47,12 +70,6 @@ private IList GenerateValueArray(ref Utf8JsonReader reader, Type typeToCo { case JsonTokenType.EndArray when reader.CurrentDepth == startDepth: return valuesArray; - case JsonTokenType.StartObject: - val = new Value(); - break; - case JsonTokenType.EndObject: - valuesArray.Add(val); - break; default: valuesArray.Add(Read(ref reader, typeToConvert, options)); break; @@ -73,7 +90,8 @@ public override void Write(Utf8JsonWriter writer, Value value, JsonSerializerOpt } else { - writer.WriteRawValue(JsonSerializer.Serialize(value.AsObject)); + writer.WriteRawValue(JsonSerializer.Serialize(value.AsObject, + JsonConverterExtensions.DefaultSerializerSettings)); } } } \ No newline at end of file diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs index cba94d16..283dadee 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs @@ -101,12 +101,6 @@ public void ToStringDictionary_WithContextWithListAndNestedList_ShouldReturnADic { var testStructure = new Structure(new Dictionary { - // { - // "config1", new Value(new Structure(new Dictionary - // { - // { "nested1", new Value(1) } - // })) - // }, { "config2", new Value([ @@ -131,4 +125,33 @@ public void ToStringDictionary_WithContextWithListAndNestedList_ShouldReturnADic JsonConverterExtensions.DefaultSerializerSettings); deserialized.Should().BeEquivalentTo(testStructure); } + + [Fact] + public void ToStringDictionary_WithContextWithNestedStructure_ShouldReturnADictionaryWithSerializedValues() + { + var testStructure = new Structure(new Dictionary + { + { + "config-value-struct", new Value(new Structure(new Dictionary + { + { "nested1", new Value(1) } + })) + }, + { "config-value-value", new Value(new Value(DateTime.Now)) } + }); + + var evaluationContext = EvaluationContext.Builder() + .SetTargetingKey(Guid.NewGuid().ToString()) + .Set("config", testStructure) + .Build(); + var result = evaluationContext.ToStringDictionary(); + + result.Should().NotBeNull(); + result.Should().NotBeEmpty(); + result.Keys.Should().Contain("config"); + + var deserialized = JsonSerializer.Deserialize>(result["config"], + JsonConverterExtensions.DefaultSerializerSettings); + deserialized.Should().BeEquivalentTo(testStructure); + } } \ No newline at end of file From d651b3cfce874bb138a517e02c238e43d813a76c Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Fri, 27 Sep 2024 20:37:47 +0200 Subject: [PATCH 09/47] FliptProvider: Implement Structure deserializer Signed-off-by: Andrei de la Cruz --- .../Converters/OpenFeatureStructureConverter.cs | 6 ++++-- .../FlipExtensionsTest.cs | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureStructureConverter.cs b/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureStructureConverter.cs index 78fa0f20..f657fe92 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureStructureConverter.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureStructureConverter.cs @@ -14,8 +14,10 @@ public class OpenFeatureStructureConverter : JsonConverter /// public override Structure Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - var structure = new Structure(new Dictionary()); - throw new NotImplementedException(); + using var jsonDocument = JsonDocument.ParseValue(ref reader); + var jsonText = jsonDocument.RootElement.GetRawText(); + return new Structure(JsonSerializer.Deserialize>(jsonText, + JsonConverterExtensions.DefaultSerializerSettings)); } /// diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs index 283dadee..e38320e9 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs @@ -66,7 +66,7 @@ public void ToStringDictionary_WithContextAndValuesOfStrings_ShouldReturnADictio result.Keys.Should().Contain("config"); JsonSerializer - .Deserialize>(result["config"], + .Deserialize(result["config"], JsonConverterExtensions.DefaultSerializerSettings).Should() .BeEquivalentTo(testStructure); } @@ -91,7 +91,7 @@ public void ToStringDictionary_WithContextAndMixedValueTypes_ShouldReturnADictio result.Should().NotBeEmpty(); result.Keys.Should().Contain("config"); - var deserialized = JsonSerializer.Deserialize>(result["config"], + var deserialized = JsonSerializer.Deserialize(result["config"], JsonConverterExtensions.DefaultSerializerSettings); deserialized.Should().BeEquivalentTo(testStructure); } @@ -121,7 +121,7 @@ public void ToStringDictionary_WithContextWithListAndNestedList_ShouldReturnADic result.Should().NotBeEmpty(); result.Keys.Should().Contain("config"); - var deserialized = JsonSerializer.Deserialize>(result["config"], + var deserialized = JsonSerializer.Deserialize(result["config"], JsonConverterExtensions.DefaultSerializerSettings); deserialized.Should().BeEquivalentTo(testStructure); } @@ -150,7 +150,7 @@ public void ToStringDictionary_WithContextWithNestedStructure_ShouldReturnADicti result.Should().NotBeEmpty(); result.Keys.Should().Contain("config"); - var deserialized = JsonSerializer.Deserialize>(result["config"], + var deserialized = JsonSerializer.Deserialize(result["config"], JsonConverterExtensions.DefaultSerializerSettings); deserialized.Should().BeEquivalentTo(testStructure); } From 77afc271cf2ff0db1c3a5710337899b9972894f7 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Mon, 30 Sep 2024 22:48:49 +0200 Subject: [PATCH 10/47] FliptProvider: Rename ClientWrapper to converter Signed-off-by: Andrei de la Cruz --- .../Converters/OpenFeatureValueConverter.cs | 2 +- .../FliptClientWrapper.cs | 132 ---------------- .../FliptProvider.cs | 33 ++-- .../FliptToOpenFeatureConverter.cs | 145 ++++++++++++++++++ .../FliptProviderTest.cs | 46 +++++- ....cs => FliptToOpenFeatureConverterTest.cs} | 2 +- ...eature.Contrib.Providers.Flipt.Test.csproj | 2 + 7 files changed, 215 insertions(+), 147 deletions(-) create mode 100644 src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs rename test/OpenFeature.Contrib.Providers.Flipt.Test/{FliptClientWrapperTest.cs => FliptToOpenFeatureConverterTest.cs} (57%) diff --git a/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureValueConverter.cs b/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureValueConverter.cs index 203dccc9..ab413429 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureValueConverter.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureValueConverter.cs @@ -62,7 +62,6 @@ private IList GenerateValueArray(ref Utf8JsonReader reader, Type typeToCo JsonSerializerOptions options) { var valuesArray = new List(); - var val = new Value(); var startDepth = reader.CurrentDepth; while (reader.Read()) @@ -78,6 +77,7 @@ private IList GenerateValueArray(ref Utf8JsonReader reader, Type typeToCo return valuesArray; } + /// public override void Write(Utf8JsonWriter writer, Value value, JsonSerializerOptions options) { if (value.IsList) diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs index dadb244d..2bb083d9 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs @@ -1,141 +1,9 @@ -using System; -using System.Net; -using System.Net.Http; -using System.Threading.Tasks; -using Flipt.Authentication; -using Flipt.Clients; -using Flipt.DTOs; -using Flipt.Utilities; -using OpenFeature.Constant; -using OpenFeature.Model; - namespace OpenFeature.Contrib.Providers.Flipt; -/// -/// A wrapper of fliptClient to handle data casting and error mappings to OpenFeature models -/// public class FliptClientWrapper : IFliptClientWrapper { - private readonly Evaluation _fliptEvaluationClient; - private readonly string _namespaceKey; - - /// - /// Wrapper that uses Flipt to OpenFeature compliant models - /// - /// Url of flipt instance - /// Namespace used for querying flags - /// Authentication access token - /// Timeout when calling flipt endpoints in seconds - public FliptClientWrapper(string fliptUrl, - string namespaceKey = "default", - string clientToken = "", - int timeoutInSeconds = 30) - { - _fliptEvaluationClient = BuildClient(fliptUrl, clientToken, timeoutInSeconds).Evaluation; - _namespaceKey = namespaceKey; - } - - /// - public async Task> EvaluateAsync(string flagKey, T defaultValue, EvaluationContext context) - { - var evaluationRequest = new EvaluationRequest(_namespaceKey, flagKey, context?.TargetingKey ?? "", - context.ToStringDictionary()); - - try - { - var evaluationResponse = await _fliptEvaluationClient.EvaluateVariantAsync(evaluationRequest); - if (!(evaluationResponse?.Match ?? false)) - return new ResolutionDetails(flagKey, defaultValue, ErrorType.None, - evaluationResponse?.Reason.ToString()); - - try - { - var convertedValue = (T)Convert.ChangeType(evaluationResponse.VariantKey, typeof(T)); - return new ResolutionDetails(flagKey, - convertedValue, ErrorType.None, - evaluationResponse.Reason.ToString()); - } - catch (InvalidCastException) - { - // cannot change type if of type Value - if (typeof(T) == typeof(Value)) - return new ResolutionDetails(flagKey, - (T)Convert.ChangeType(new Value(evaluationResponse.VariantAttachment), typeof(T)), - ErrorType.None, evaluationResponse.Reason.ToString()); - return new ResolutionDetails(flagKey, defaultValue, ErrorType.TypeMismatch); - } - catch (FormatException) - { - return new ResolutionDetails(flagKey, defaultValue, ErrorType.TypeMismatch); - } - } - catch (HttpRequestException e) - { - return HandleRequestException(e, flagKey, defaultValue); - } - } - - /// - public async Task> EvaluateBooleanAsync(string flagKey, bool defaultValue, - EvaluationContext context) - { - var evaluationRequest = new EvaluationRequest(_namespaceKey, flagKey, context?.TargetingKey ?? "", - context.ToStringDictionary()); - - try - { - var boolEvaluationResponse = await _fliptEvaluationClient.EvaluateBooleanAsync(evaluationRequest); - return new ResolutionDetails(flagKey, boolEvaluationResponse?.Enabled ?? defaultValue, ErrorType.None, - boolEvaluationResponse?.Reason.ToString()); - } - catch (HttpRequestException e) - { - return HandleRequestException(e, flagKey, defaultValue); - } - } - - private ResolutionDetails HandleRequestException(HttpRequestException e, string flagKey, T defaultValue) - { - var error = e.StatusCode switch - { - HttpStatusCode.NotFound => ErrorType.FlagNotFound, - HttpStatusCode.BadRequest => ErrorType.TypeMismatch, - _ => ErrorType.General - }; - return new ResolutionDetails(flagKey, defaultValue, error, errorMessage: e.Message); - } - - private static FliptClient BuildClient(string fliptUrl, string clientToken, int timeoutInSeconds = 30) - { - return FliptClient.Builder() - .WithUrl(fliptUrl) - .WithAuthentication(new ClientTokenAuthenticationStrategy(clientToken)) - .WithTimeout(timeoutInSeconds) - .Build(); - } } -/// -/// Contract for fliptClient wrapper -/// public interface IFliptClientWrapper { - /// - /// Used for evaluating non-boolean flags. Flipt handles datatypes which is not boolean as variants - /// - /// - /// - /// - /// - /// OpenFeature ResolutionDetails object - Task> EvaluateAsync(string flagKey, T defaultValue, EvaluationContext context); - - /// - /// Used for evaluating boolean flags - /// - /// - /// - /// - /// OpenFeature ResolutionDetails object - Task> EvaluateBooleanAsync(string flagKey, bool defaultValue, EvaluationContext context); } \ No newline at end of file diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptProvider.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptProvider.cs index c24ed128..d34a06ba 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/FliptProvider.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptProvider.cs @@ -13,16 +13,25 @@ namespace OpenFeature.Contrib.Providers.Flipt; /// Namespace used for querying flags /// Authentication access token /// Timeout when calling flipt endpoints in seconds -public class FliptProvider( - string fliptUrl, - string namespaceKey = "default", - string clientToken = "", - int timeoutInSeconds = 30) : FeatureProvider +/// +/// Accepts an instantiated IFliptClientWrapper instance +/// +/// +public class FliptProvider(IFliptToOpenFeatureConverter fliptToOpenFeatureConverter) : FeatureProvider { private static readonly Metadata Metadata = new("Flipt Provider"); - private readonly IFliptClientWrapper _fliptClientWrapper = - new FliptClientWrapper(fliptUrl, namespaceKey, clientToken, timeoutInSeconds); + /// + /// Instantiate a FliptProvider using configuration params + /// + /// Url of flipt instance + /// Namespace used for querying flags + /// Authentication access token + /// Timeout when calling flipt endpoints in seconds + public FliptProvider(string fliptUrl, string namespaceKey = "default", string clientToken = "", + int timeoutInSeconds = 30) : this(new FliptToOpenFeatureConverter(fliptUrl, namespaceKey, clientToken, timeoutInSeconds)) + { + } /// public override Metadata GetMetadata() @@ -35,7 +44,7 @@ public override async Task> ResolveBooleanValueAsync(str EvaluationContext context = null, CancellationToken cancellationToken = new()) { - return await _fliptClientWrapper.EvaluateBooleanAsync(flagKey, defaultValue, context); + return await fliptToOpenFeatureConverter.EvaluateBooleanAsync(flagKey, defaultValue, context); } /// @@ -43,7 +52,7 @@ public override async Task> ResolveStringValueAsync(st string defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = new()) { - return await _fliptClientWrapper.EvaluateAsync(flagKey, defaultValue, context); + return await fliptToOpenFeatureConverter.EvaluateAsync(flagKey, defaultValue, context); } /// @@ -51,7 +60,7 @@ public override async Task> ResolveIntegerValueAsync(stri EvaluationContext context = null, CancellationToken cancellationToken = new()) { - return await _fliptClientWrapper.EvaluateAsync(flagKey, defaultValue, context); + return await fliptToOpenFeatureConverter.EvaluateAsync(flagKey, defaultValue, context); } /// @@ -59,7 +68,7 @@ public override async Task> ResolveDoubleValueAsync(st EvaluationContext context = null, CancellationToken cancellationToken = new()) { - return await _fliptClientWrapper.EvaluateAsync(flagKey, defaultValue, context); + return await fliptToOpenFeatureConverter.EvaluateAsync(flagKey, defaultValue, context); } /// @@ -67,6 +76,6 @@ public override async Task> ResolveStructureValueAsync( EvaluationContext context = null, CancellationToken cancellationToken = new()) { - return await _fliptClientWrapper.EvaluateAsync(flagKey, defaultValue, context); + return await fliptToOpenFeatureConverter.EvaluateAsync(flagKey, defaultValue, context); } } \ No newline at end of file diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs new file mode 100644 index 00000000..28061ce8 --- /dev/null +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs @@ -0,0 +1,145 @@ +using System; +using System.Net; +using System.Net.Http; +using System.Threading.Tasks; +using Flipt.Authentication; +using Flipt.Clients; +using Flipt.DTOs; +using Flipt.Utilities; +using OpenFeature.Constant; +using OpenFeature.Model; + +namespace OpenFeature.Contrib.Providers.Flipt; + +/// +/// A wrapper of fliptClient to handle data casting and error mappings to OpenFeature models +/// +public class FliptToOpenFeatureConverter(Evaluation fliptEvaluationClient, string namespaceKey = "default") + : IFliptToOpenFeatureConverter +{ + /// + /// Wrapper that uses Flipt to OpenFeature compliant models + /// + /// Url of flipt instance + /// Namespace used for querying flags + /// Authentication access token + /// Timeout when calling flipt endpoints in seconds + public FliptToOpenFeatureConverter(string fliptUrl, + string namespaceKey = "default", + string clientToken = "", + int timeoutInSeconds = 30) : this(BuildClient(fliptUrl, clientToken, timeoutInSeconds).Evaluation, namespaceKey) + { + } + + /// + public async Task> EvaluateAsync(string flagKey, T defaultValue, EvaluationContext context) + { + var evaluationRequest = new EvaluationRequest(namespaceKey, flagKey, context?.TargetingKey ?? "", + context.ToStringDictionary()); + + if (fliptEvaluationClient == null) + return new ResolutionDetails(flagKey, defaultValue, ErrorType.ProviderNotReady); + + try + { + var evaluationResponse = await fliptEvaluationClient.EvaluateVariantAsync(evaluationRequest); + if (!(evaluationResponse?.Match ?? false)) + return new ResolutionDetails(flagKey, defaultValue, ErrorType.None, + evaluationResponse?.Reason.ToString()); + // Todo Andrei: + // Create another layer that just converts errors and responses to OpenFeature compliant models and responses + try + { + var convertedValue = (T)Convert.ChangeType(evaluationResponse.VariantKey, typeof(T)); + return new ResolutionDetails(flagKey, + convertedValue, ErrorType.None, + evaluationResponse.Reason.ToString()); + } + catch (InvalidCastException) + { + // handle differently if type is Value + if (typeof(T) == typeof(Value)) + return new ResolutionDetails(flagKey, + (T)Convert.ChangeType(new Value(evaluationResponse.VariantAttachment), typeof(T)), + ErrorType.None, evaluationResponse.Reason.ToString()); + return new ResolutionDetails(flagKey, defaultValue, ErrorType.TypeMismatch); + } + catch (FormatException) + { + return new ResolutionDetails(flagKey, defaultValue, ErrorType.TypeMismatch); + } + } + catch (HttpRequestException ex) + { + return ResolutionDetailFromHttpException(ex, flagKey, defaultValue); + } + } + + /// + public async Task> EvaluateBooleanAsync(string flagKey, bool defaultValue, + EvaluationContext context) + { + if (fliptEvaluationClient == null) + return new ResolutionDetails(flagKey, defaultValue, ErrorType.ProviderNotReady); + try + { + var evaluationRequest = new EvaluationRequest(namespaceKey, flagKey, context?.TargetingKey ?? "", + context.ToStringDictionary()); + + var boolEvaluationResponse = await fliptEvaluationClient.EvaluateBooleanAsync(evaluationRequest); + return new ResolutionDetails(flagKey, boolEvaluationResponse?.Enabled ?? defaultValue, ErrorType.None, + boolEvaluationResponse?.Reason.ToString()); + } + catch (HttpRequestException ex) + { + return ResolutionDetailFromHttpException(ex, flagKey, defaultValue); + } + } + + private static ResolutionDetails ResolutionDetailFromHttpException(HttpRequestException e, string flagKey, + T defaultValue) + { + var error = e.StatusCode switch + { + HttpStatusCode.NotFound => ErrorType.FlagNotFound, + HttpStatusCode.BadRequest => ErrorType.TypeMismatch, + HttpStatusCode.InternalServerError => ErrorType.ProviderNotReady, + _ => ErrorType.General + }; + return new ResolutionDetails(flagKey, defaultValue, error, errorMessage: e.Message); + } + + private static FliptClient BuildClient(string fliptUrl, string clientToken, int timeoutInSeconds = 30) + { + return FliptClient.Builder() + .WithUrl(fliptUrl) + .WithAuthentication(new ClientTokenAuthenticationStrategy(clientToken)) + .WithTimeout(timeoutInSeconds) + .Build(); + } +} + +/// +/// Contract for fliptClient wrapper +/// +public interface IFliptToOpenFeatureConverter +{ + /// + /// Used for evaluating non-boolean flags. Flipt handles datatypes which is not boolean as variants + /// + /// + /// + /// + /// + /// OpenFeature ResolutionDetails object + Task> EvaluateAsync(string flagKey, T defaultValue, EvaluationContext context); + + /// + /// Used for evaluating boolean flags + /// + /// + /// + /// + /// OpenFeature ResolutionDetails object + Task> EvaluateBooleanAsync(string flagKey, bool defaultValue, EvaluationContext context); +} \ No newline at end of file diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs index f2c1ca06..f08154f8 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs @@ -1,6 +1,50 @@ +using System.Net; +using Flipt.Clients; +using Flipt.DTOs; +using FluentAssertions; +using Moq; +using OpenFeature.Constant; + namespace OpenFeature.Contrib.Providers.Flipt.Test; public class FliptProviderTest { - + private readonly string _fliptUrl = "http://localhost:8080/"; + + [Fact] + public void CreateFliptProvider_ShouldReturnFliptProvider() + { + // Flipt library always returns a flipt instance + var fliptProvider = new FliptProvider(_fliptUrl); + Assert.NotNull(fliptProvider); + } + + [Fact] + public void CreateFliptProvider_GivenEmptyUrl_ShouldThrowInvalidOperationException() + { + var act = void () => new FliptProvider(""); + act.Should().Throw() + .WithMessage("BaseURL must be provided."); + } + + [Theory] + [InlineData(HttpStatusCode.NotFound, ErrorType.FlagNotFound)] + [InlineData(HttpStatusCode.BadRequest, ErrorType.TypeMismatch)] + [InlineData(HttpStatusCode.InternalServerError, ErrorType.ProviderNotReady)] + [InlineData(HttpStatusCode.Forbidden, ErrorType.ProviderNotReady)] + public async Task ResolveBooleanValueAsync_GivenWrongURl_ShouldHandleHttpRequestException( + HttpStatusCode thrownStatusCode, ErrorType expectedOpenFeatureErrorType) + { + var evaluationClient = new Mock(); + evaluationClient.Setup(ev => + ev.EvaluateBooleanAsync(new EvaluationRequest("", "", Guid.NewGuid().ToString(), + new Dictionary()))) + .ThrowsAsync(new HttpRequestException("", null, thrownStatusCode)); + + + var fliptProvider = new FliptProvider(new FliptToOpenFeatureConverter(evaluationClient.Object)); + var resolution = await fliptProvider.ResolveBooleanValueAsync("flagKey", false); + resolution.Should().Be(false); + resolution.ErrorType.Should().Be(expectedOpenFeatureErrorType); + } } \ No newline at end of file diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptClientWrapperTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs similarity index 57% rename from test/OpenFeature.Contrib.Providers.Flipt.Test/FliptClientWrapperTest.cs rename to test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs index b406ad58..45a41679 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptClientWrapperTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs @@ -1,6 +1,6 @@ namespace OpenFeature.Contrib.Providers.Flipt.Test; -public class FliptClientWrapperTest +public class FliptToOpenFeatureConverterTest { } \ No newline at end of file diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj b/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj index 89986460..df3c0e7f 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj @@ -13,9 +13,11 @@ + + From a9ca17f7687d750994e929e6993c2ef3f99b5cc5 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Mon, 30 Sep 2024 23:08:59 +0200 Subject: [PATCH 11/47] FliptProvider: Implemented wrapper class, added unit tests Signed-off-by: Andrei de la Cruz --- .../FliptClientWrapper.cs | 56 +++++++++++++++++++ .../FliptToOpenFeatureConverter.cs | 27 ++------- .../FliptProviderTest.cs | 24 ++++---- 3 files changed, 73 insertions(+), 34 deletions(-) diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs index 2bb083d9..92631818 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs @@ -1,9 +1,65 @@ +using System.Threading.Tasks; +using Flipt.Authentication; +using Flipt.Clients; +using Flipt.DTOs; +using Flipt.Utilities; + namespace OpenFeature.Contrib.Providers.Flipt; +/// +/// Wrapper for Flipt server sdk client for .net +/// public class FliptClientWrapper : IFliptClientWrapper { + private readonly Evaluation _fliptEvaluationClient; + + /// + /// + /// Url of flipt instance + /// Authentication access token + /// Timeout when calling flipt endpoints in seconds + public FliptClientWrapper(string fliptUrl, + string clientToken = "", + int timeoutInSeconds = 30) + { + _fliptEvaluationClient = BuildClient(fliptUrl, clientToken, timeoutInSeconds).Evaluation; + } + + /// + public async Task EvaluateVariantAsync(EvaluationRequest evaluationRequest) + { + return await _fliptEvaluationClient.EvaluateVariantAsync(evaluationRequest); + } + + /// + public async Task EvaluateBooleanAsync(EvaluationRequest evaluationRequest) + { + return await _fliptEvaluationClient.EvaluateBooleanAsync(evaluationRequest); + } + + private static FliptClient BuildClient(string fliptUrl, string clientToken, int timeoutInSeconds = 30) + { + return FliptClient.Builder() + .WithUrl(fliptUrl) + .WithAuthentication(new ClientTokenAuthenticationStrategy(clientToken)) + .WithTimeout(timeoutInSeconds) + .Build(); + } } +/// +/// public interface IFliptClientWrapper { + /// + /// + /// + /// + Task EvaluateVariantAsync(EvaluationRequest evaluationRequest); + + /// + /// + /// + /// + Task EvaluateBooleanAsync(EvaluationRequest evaluationRequest); } \ No newline at end of file diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs index 28061ce8..d76cc7d3 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs @@ -2,10 +2,7 @@ using System.Net; using System.Net.Http; using System.Threading.Tasks; -using Flipt.Authentication; -using Flipt.Clients; using Flipt.DTOs; -using Flipt.Utilities; using OpenFeature.Constant; using OpenFeature.Model; @@ -14,7 +11,7 @@ namespace OpenFeature.Contrib.Providers.Flipt; /// /// A wrapper of fliptClient to handle data casting and error mappings to OpenFeature models /// -public class FliptToOpenFeatureConverter(Evaluation fliptEvaluationClient, string namespaceKey = "default") +public class FliptToOpenFeatureConverter(IFliptClientWrapper fliptClientWrapper, string namespaceKey = "default") : IFliptToOpenFeatureConverter { /// @@ -27,7 +24,8 @@ public class FliptToOpenFeatureConverter(Evaluation fliptEvaluationClient, strin public FliptToOpenFeatureConverter(string fliptUrl, string namespaceKey = "default", string clientToken = "", - int timeoutInSeconds = 30) : this(BuildClient(fliptUrl, clientToken, timeoutInSeconds).Evaluation, namespaceKey) + int timeoutInSeconds = 30) : this(new FliptClientWrapper(fliptUrl, clientToken, timeoutInSeconds), + namespaceKey) { } @@ -37,12 +35,9 @@ public async Task> EvaluateAsync(string flagKey, T defau var evaluationRequest = new EvaluationRequest(namespaceKey, flagKey, context?.TargetingKey ?? "", context.ToStringDictionary()); - if (fliptEvaluationClient == null) - return new ResolutionDetails(flagKey, defaultValue, ErrorType.ProviderNotReady); - try { - var evaluationResponse = await fliptEvaluationClient.EvaluateVariantAsync(evaluationRequest); + var evaluationResponse = await fliptClientWrapper.EvaluateVariantAsync(evaluationRequest); if (!(evaluationResponse?.Match ?? false)) return new ResolutionDetails(flagKey, defaultValue, ErrorType.None, evaluationResponse?.Reason.ToString()); @@ -79,14 +74,12 @@ public async Task> EvaluateAsync(string flagKey, T defau public async Task> EvaluateBooleanAsync(string flagKey, bool defaultValue, EvaluationContext context) { - if (fliptEvaluationClient == null) - return new ResolutionDetails(flagKey, defaultValue, ErrorType.ProviderNotReady); try { var evaluationRequest = new EvaluationRequest(namespaceKey, flagKey, context?.TargetingKey ?? "", context.ToStringDictionary()); - var boolEvaluationResponse = await fliptEvaluationClient.EvaluateBooleanAsync(evaluationRequest); + var boolEvaluationResponse = await fliptClientWrapper.EvaluateBooleanAsync(evaluationRequest); return new ResolutionDetails(flagKey, boolEvaluationResponse?.Enabled ?? defaultValue, ErrorType.None, boolEvaluationResponse?.Reason.ToString()); } @@ -103,20 +96,12 @@ private static ResolutionDetails ResolutionDetailFromHttpException(HttpReq { HttpStatusCode.NotFound => ErrorType.FlagNotFound, HttpStatusCode.BadRequest => ErrorType.TypeMismatch, + HttpStatusCode.Forbidden => ErrorType.ProviderNotReady, HttpStatusCode.InternalServerError => ErrorType.ProviderNotReady, _ => ErrorType.General }; return new ResolutionDetails(flagKey, defaultValue, error, errorMessage: e.Message); } - - private static FliptClient BuildClient(string fliptUrl, string clientToken, int timeoutInSeconds = 30) - { - return FliptClient.Builder() - .WithUrl(fliptUrl) - .WithAuthentication(new ClientTokenAuthenticationStrategy(clientToken)) - .WithTimeout(timeoutInSeconds) - .Build(); - } } /// diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs index f08154f8..45e3b889 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs @@ -1,5 +1,4 @@ using System.Net; -using Flipt.Clients; using Flipt.DTOs; using FluentAssertions; using Moq; @@ -28,23 +27,22 @@ public void CreateFliptProvider_GivenEmptyUrl_ShouldThrowInvalidOperationExcepti } [Theory] - [InlineData(HttpStatusCode.NotFound, ErrorType.FlagNotFound)] - [InlineData(HttpStatusCode.BadRequest, ErrorType.TypeMismatch)] - [InlineData(HttpStatusCode.InternalServerError, ErrorType.ProviderNotReady)] - [InlineData(HttpStatusCode.Forbidden, ErrorType.ProviderNotReady)] + [InlineData(HttpStatusCode.NotFound, ErrorType.FlagNotFound, false)] + [InlineData(HttpStatusCode.BadRequest, ErrorType.TypeMismatch, false)] + [InlineData(HttpStatusCode.InternalServerError, ErrorType.ProviderNotReady, false)] + [InlineData(HttpStatusCode.Forbidden, ErrorType.ProviderNotReady, false)] public async Task ResolveBooleanValueAsync_GivenWrongURl_ShouldHandleHttpRequestException( - HttpStatusCode thrownStatusCode, ErrorType expectedOpenFeatureErrorType) + HttpStatusCode thrownStatusCode, ErrorType expectedOpenFeatureErrorType, bool fallbackValue) { - var evaluationClient = new Mock(); - evaluationClient.Setup(ev => - ev.EvaluateBooleanAsync(new EvaluationRequest("", "", Guid.NewGuid().ToString(), - new Dictionary()))) + var mockFliptClientWrapper = new Mock(); + mockFliptClientWrapper.Setup(ev => + ev.EvaluateBooleanAsync(It.IsAny())) .ThrowsAsync(new HttpRequestException("", null, thrownStatusCode)); - var fliptProvider = new FliptProvider(new FliptToOpenFeatureConverter(evaluationClient.Object)); - var resolution = await fliptProvider.ResolveBooleanValueAsync("flagKey", false); - resolution.Should().Be(false); + var fliptProvider = new FliptProvider(new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object)); + var resolution = await fliptProvider.ResolveBooleanValueAsync("flagKey", fallbackValue); + resolution.Value.Should().Be(fallbackValue); resolution.ErrorType.Should().Be(expectedOpenFeatureErrorType); } } \ No newline at end of file From d98f9cea051ea34ca913ce5532edf3ed74868cf9 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Mon, 30 Sep 2024 23:13:51 +0200 Subject: [PATCH 12/47] FliptProvider: Code cleanup Signed-off-by: Andrei de la Cruz --- .../FliptClientWrapper.cs | 2 ++ .../FliptToOpenFeatureConverter.cs | 2 -- .../FliptProviderTest.cs | 2 +- .../FliptToOpenFeatureConverterTest.cs | 6 ------ 4 files changed, 3 insertions(+), 9 deletions(-) delete mode 100644 test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs index 92631818..3d8235d6 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs @@ -52,12 +52,14 @@ private static FliptClient BuildClient(string fliptUrl, string clientToken, int public interface IFliptClientWrapper { /// + /// Wrapper to Flipt.io/EvaluateVariantAsync method /// /// /// Task EvaluateVariantAsync(EvaluationRequest evaluationRequest); /// + /// Wrapper to Flipt.io/EvaluateBooleanAsync method /// /// /// diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs index d76cc7d3..f65eae4a 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs @@ -41,8 +41,6 @@ public async Task> EvaluateAsync(string flagKey, T defau if (!(evaluationResponse?.Match ?? false)) return new ResolutionDetails(flagKey, defaultValue, ErrorType.None, evaluationResponse?.Reason.ToString()); - // Todo Andrei: - // Create another layer that just converts errors and responses to OpenFeature compliant models and responses try { var convertedValue = (T)Convert.ChangeType(evaluationResponse.VariantKey, typeof(T)); diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs index 45e3b889..1e7126e7 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs @@ -31,7 +31,7 @@ public void CreateFliptProvider_GivenEmptyUrl_ShouldThrowInvalidOperationExcepti [InlineData(HttpStatusCode.BadRequest, ErrorType.TypeMismatch, false)] [InlineData(HttpStatusCode.InternalServerError, ErrorType.ProviderNotReady, false)] [InlineData(HttpStatusCode.Forbidden, ErrorType.ProviderNotReady, false)] - public async Task ResolveBooleanValueAsync_GivenWrongURl_ShouldHandleHttpRequestException( + public async Task ResolveBooleanValueAsync_GivenHttpRequestException_ShouldHandleHttpRequestException( HttpStatusCode thrownStatusCode, ErrorType expectedOpenFeatureErrorType, bool fallbackValue) { var mockFliptClientWrapper = new Mock(); diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs deleted file mode 100644 index 45a41679..00000000 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OpenFeature.Contrib.Providers.Flipt.Test; - -public class FliptToOpenFeatureConverterTest -{ - -} \ No newline at end of file From 48c555c12f0d89f941092dfd7fd252b45fe23301 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Tue, 1 Oct 2024 10:36:30 +0200 Subject: [PATCH 13/47] FliptProvider: Extracted Converter tests to its own file Signed-off-by: Andrei de la Cruz --- .../FliptToOpenFeatureConverter.cs | 10 ++-- .../FlipToOpenFeatureConverterTest.cs | 50 +++++++++++++++++++ .../FliptProviderTest.cs | 24 --------- 3 files changed, 56 insertions(+), 28 deletions(-) create mode 100644 test/OpenFeature.Contrib.Providers.Flipt.Test/FlipToOpenFeatureConverterTest.cs diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs index f65eae4a..da007b11 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs @@ -30,7 +30,8 @@ public FliptToOpenFeatureConverter(string fliptUrl, } /// - public async Task> EvaluateAsync(string flagKey, T defaultValue, EvaluationContext context) + public async Task> EvaluateAsync(string flagKey, T defaultValue, + EvaluationContext context = null) { var evaluationRequest = new EvaluationRequest(namespaceKey, flagKey, context?.TargetingKey ?? "", context.ToStringDictionary()); @@ -70,7 +71,7 @@ public async Task> EvaluateAsync(string flagKey, T defau /// public async Task> EvaluateBooleanAsync(string flagKey, bool defaultValue, - EvaluationContext context) + EvaluationContext context = null) { try { @@ -115,7 +116,7 @@ public interface IFliptToOpenFeatureConverter /// /// /// OpenFeature ResolutionDetails object - Task> EvaluateAsync(string flagKey, T defaultValue, EvaluationContext context); + Task> EvaluateAsync(string flagKey, T defaultValue, EvaluationContext context = null); /// /// Used for evaluating boolean flags @@ -124,5 +125,6 @@ public interface IFliptToOpenFeatureConverter /// /// /// OpenFeature ResolutionDetails object - Task> EvaluateBooleanAsync(string flagKey, bool defaultValue, EvaluationContext context); + Task> EvaluateBooleanAsync(string flagKey, bool defaultValue, + EvaluationContext context = null); } \ No newline at end of file diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipToOpenFeatureConverterTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipToOpenFeatureConverterTest.cs new file mode 100644 index 00000000..c09a0bd0 --- /dev/null +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipToOpenFeatureConverterTest.cs @@ -0,0 +1,50 @@ +using System.Net; +using Flipt.DTOs; +using FluentAssertions; +using Moq; +using OpenFeature.Constant; + +namespace OpenFeature.Contrib.Providers.Flipt.Test; + +public class FlipToOpenFeatureConverterTest +{ + [Theory] + [InlineData(HttpStatusCode.NotFound, ErrorType.FlagNotFound, false)] + [InlineData(HttpStatusCode.BadRequest, ErrorType.TypeMismatch, false)] + [InlineData(HttpStatusCode.InternalServerError, ErrorType.ProviderNotReady, false)] + [InlineData(HttpStatusCode.Forbidden, ErrorType.ProviderNotReady, false)] + [InlineData(HttpStatusCode.TooManyRequests, ErrorType.General, false)] + public async Task EvaluateBooleanAsync_GivenHttpRequestException_ShouldHandleHttpRequestException( + HttpStatusCode thrownStatusCode, ErrorType expectedOpenFeatureErrorType, bool fallbackValue) + { + var mockFliptClientWrapper = new Mock(); + mockFliptClientWrapper.Setup(ev => + ev.EvaluateBooleanAsync(It.IsAny())) + .ThrowsAsync(new HttpRequestException("", null, thrownStatusCode)); + + var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); + var resolution = await fliptToOpenFeature.EvaluateBooleanAsync("flagKey", fallbackValue); + resolution.Value.Should().Be(fallbackValue); + resolution.ErrorType.Should().Be(expectedOpenFeatureErrorType); + } + + [Theory] + [InlineData(HttpStatusCode.NotFound, ErrorType.FlagNotFound, 0.0)] + [InlineData(HttpStatusCode.BadRequest, ErrorType.TypeMismatch, 0.0)] + [InlineData(HttpStatusCode.InternalServerError, ErrorType.ProviderNotReady, 0.0)] + [InlineData(HttpStatusCode.Forbidden, ErrorType.ProviderNotReady, 0.0)] + [InlineData(HttpStatusCode.TooManyRequests, ErrorType.General, 0.0)] + public async Task EvaluateAsync_GivenHttpRequestException_ShouldHandleHttpRequestException( + HttpStatusCode thrownStatusCode, ErrorType expectedOpenFeatureErrorType, double fallbackValue) + { + var mockFliptClientWrapper = new Mock(); + mockFliptClientWrapper.Setup(ev => + ev.EvaluateVariantAsync(It.IsAny())) + .ThrowsAsync(new HttpRequestException("", null, thrownStatusCode)); + + var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); + var resolution = await fliptToOpenFeature.EvaluateAsync("flagKey", fallbackValue); + resolution.Value.Should().Be(fallbackValue); + resolution.ErrorType.Should().Be(expectedOpenFeatureErrorType); + } +} \ No newline at end of file diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs index 1e7126e7..b56f2c20 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs @@ -1,8 +1,4 @@ -using System.Net; -using Flipt.DTOs; using FluentAssertions; -using Moq; -using OpenFeature.Constant; namespace OpenFeature.Contrib.Providers.Flipt.Test; @@ -25,24 +21,4 @@ public void CreateFliptProvider_GivenEmptyUrl_ShouldThrowInvalidOperationExcepti act.Should().Throw() .WithMessage("BaseURL must be provided."); } - - [Theory] - [InlineData(HttpStatusCode.NotFound, ErrorType.FlagNotFound, false)] - [InlineData(HttpStatusCode.BadRequest, ErrorType.TypeMismatch, false)] - [InlineData(HttpStatusCode.InternalServerError, ErrorType.ProviderNotReady, false)] - [InlineData(HttpStatusCode.Forbidden, ErrorType.ProviderNotReady, false)] - public async Task ResolveBooleanValueAsync_GivenHttpRequestException_ShouldHandleHttpRequestException( - HttpStatusCode thrownStatusCode, ErrorType expectedOpenFeatureErrorType, bool fallbackValue) - { - var mockFliptClientWrapper = new Mock(); - mockFliptClientWrapper.Setup(ev => - ev.EvaluateBooleanAsync(It.IsAny())) - .ThrowsAsync(new HttpRequestException("", null, thrownStatusCode)); - - - var fliptProvider = new FliptProvider(new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object)); - var resolution = await fliptProvider.ResolveBooleanValueAsync("flagKey", fallbackValue); - resolution.Value.Should().Be(fallbackValue); - resolution.ErrorType.Should().Be(expectedOpenFeatureErrorType); - } } \ No newline at end of file From d4b3e42959c56f356b266ad224db19fe3723c3e9 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Wed, 2 Oct 2024 22:02:33 +0200 Subject: [PATCH 14/47] Added unit tests for FliptToOpenFeature converter for variants and booleans Signed-off-by: Andrei de la Cruz --- .../Converters/JsonConverterExtensions.cs | 4 + .../FliptToOpenFeatureConverter.cs | 48 ++++--- .../FlipToOpenFeatureConverterTest.cs | 130 +++++++++++++++++- .../FliptProviderTest.cs | 43 ++++++ 4 files changed, 203 insertions(+), 22 deletions(-) diff --git a/src/OpenFeature.Contrib.Providers.Flipt/Converters/JsonConverterExtensions.cs b/src/OpenFeature.Contrib.Providers.Flipt/Converters/JsonConverterExtensions.cs index 0f1579cd..d1ebbbf4 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/Converters/JsonConverterExtensions.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/Converters/JsonConverterExtensions.cs @@ -7,9 +7,13 @@ namespace OpenFeature.Contrib.Providers.Flipt.Converters; /// public static class JsonConverterExtensions { + /// + /// JsonConverter serializer settings for Flipt to OpenFeature model deserialization + /// public static readonly JsonSerializerOptions DefaultSerializerSettings = new() { WriteIndented = true, + AllowTrailingCommas = true, Converters = { new OpenFeatureStructureConverter(), diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs index da007b11..e7b6213d 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs @@ -1,10 +1,13 @@ using System; using System.Net; using System.Net.Http; +using System.Text.Json; using System.Threading.Tasks; using Flipt.DTOs; using OpenFeature.Constant; +using OpenFeature.Contrib.Providers.Flipt.Converters; using OpenFeature.Model; +using Reason = Flipt.Models.Reason; namespace OpenFeature.Contrib.Providers.Flipt; @@ -39,34 +42,43 @@ public async Task> EvaluateAsync(string flagKey, T defau try { var evaluationResponse = await fliptClientWrapper.EvaluateVariantAsync(evaluationRequest); - if (!(evaluationResponse?.Match ?? false)) + + if (evaluationResponse.Reason == Reason.FlagDisabledEvaluationReason) return new ResolutionDetails(flagKey, defaultValue, ErrorType.None, - evaluationResponse?.Reason.ToString()); - try - { - var convertedValue = (T)Convert.ChangeType(evaluationResponse.VariantKey, typeof(T)); - return new ResolutionDetails(flagKey, - convertedValue, ErrorType.None, evaluationResponse.Reason.ToString()); - } - catch (InvalidCastException) + + if (!evaluationResponse.Match) + return new ResolutionDetails(flagKey, defaultValue, ErrorType.None, + evaluationResponse.Reason.ToString()); + try { - // handle differently if type is Value - if (typeof(T) == typeof(Value)) + if (string.IsNullOrEmpty(evaluationResponse.VariantAttachment)) + { + var convertedValue = (T)Convert.ChangeType(evaluationResponse.VariantKey, typeof(T)); return new ResolutionDetails(flagKey, - (T)Convert.ChangeType(new Value(evaluationResponse.VariantAttachment), typeof(T)), - ErrorType.None, evaluationResponse.Reason.ToString()); - return new ResolutionDetails(flagKey, defaultValue, ErrorType.TypeMismatch); + convertedValue, ErrorType.None, + evaluationResponse.Reason.ToString(), evaluationResponse.VariantKey); + } + + var deserializedValueObj = JsonSerializer.Deserialize(evaluationResponse.VariantAttachment, + JsonConverterExtensions.DefaultSerializerSettings); + + return new ResolutionDetails(flagKey, + (T)Convert.ChangeType(deserializedValueObj, typeof(T)), + ErrorType.None, evaluationResponse.Reason.ToString(), evaluationResponse.VariantKey); } - catch (FormatException) + catch (Exception ex) { - return new ResolutionDetails(flagKey, defaultValue, ErrorType.TypeMismatch); + if (ex is InvalidCastException or FormatException) + return new ResolutionDetails(flagKey, defaultValue, ErrorType.TypeMismatch); } } catch (HttpRequestException ex) { return ResolutionDetailFromHttpException(ex, flagKey, defaultValue); } + + return new ResolutionDetails(flagKey, defaultValue, ErrorType.General); } /// @@ -79,8 +91,8 @@ public async Task> EvaluateBooleanAsync(string flagKey, context.ToStringDictionary()); var boolEvaluationResponse = await fliptClientWrapper.EvaluateBooleanAsync(evaluationRequest); - return new ResolutionDetails(flagKey, boolEvaluationResponse?.Enabled ?? defaultValue, ErrorType.None, - boolEvaluationResponse?.Reason.ToString()); + return new ResolutionDetails(flagKey, boolEvaluationResponse.Enabled, ErrorType.None, + boolEvaluationResponse.Reason.ToString()); } catch (HttpRequestException ex) { diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipToOpenFeatureConverterTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipToOpenFeatureConverterTest.cs index c09a0bd0..d86d4ba3 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipToOpenFeatureConverterTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipToOpenFeatureConverterTest.cs @@ -3,11 +3,14 @@ using FluentAssertions; using Moq; using OpenFeature.Constant; +using OpenFeature.Model; +using Reason = Flipt.Models.Reason; namespace OpenFeature.Contrib.Providers.Flipt.Test; public class FlipToOpenFeatureConverterTest { + // EvaluateBooleanAsync Tests [Theory] [InlineData(HttpStatusCode.NotFound, ErrorType.FlagNotFound, false)] [InlineData(HttpStatusCode.BadRequest, ErrorType.TypeMismatch, false)] @@ -18,8 +21,8 @@ public async Task EvaluateBooleanAsync_GivenHttpRequestException_ShouldHandleHtt HttpStatusCode thrownStatusCode, ErrorType expectedOpenFeatureErrorType, bool fallbackValue) { var mockFliptClientWrapper = new Mock(); - mockFliptClientWrapper.Setup(ev => - ev.EvaluateBooleanAsync(It.IsAny())) + mockFliptClientWrapper.Setup(fcw => + fcw.EvaluateBooleanAsync(It.IsAny())) .ThrowsAsync(new HttpRequestException("", null, thrownStatusCode)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); @@ -28,6 +31,48 @@ public async Task EvaluateBooleanAsync_GivenHttpRequestException_ShouldHandleHtt resolution.ErrorType.Should().Be(expectedOpenFeatureErrorType); } + [Theory] + [InlineData("show-feature", true)] + [InlineData("show-feature", false)] + public async Task EvaluateBooleanAsync_GivenExistingFlag_ShouldReturnFlagValue(string flagKey, + bool valueFromSrc) + { + var mockFliptClientWrapper = new Mock(); + mockFliptClientWrapper.Setup(fcw => fcw.EvaluateBooleanAsync(It.IsAny())) + .ReturnsAsync(new BooleanEvaluationResponse + { + Enabled = valueFromSrc, + FlagKey = flagKey, + RequestId = Guid.NewGuid().ToString() + }); + + var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); + var resolution = await fliptToOpenFeature.EvaluateBooleanAsync("show-feature", false); + + resolution.FlagKey.Should().Be(flagKey); + resolution.Value.Should().Be(valueFromSrc); + } + + [Theory] + [InlineData("show-feature", false)] + [InlineData("show-feature", true)] + public async Task EvaluateBooleanAsync_GivenNonExistentFlag_ShouldReturnDefaultValueWithFlagNotFoundError( + string flagKey, bool fallBackValue) + { + var mockFliptClientWrapper = new Mock(); + mockFliptClientWrapper.Setup(fcw => fcw.EvaluateBooleanAsync(It.IsAny())) + .ThrowsAsync(new HttpRequestException("", null, HttpStatusCode.NotFound)); + + var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); + var resolution = await fliptToOpenFeature.EvaluateBooleanAsync("show-feature", fallBackValue); + + resolution.FlagKey.Should().Be(flagKey); + resolution.Value.Should().Be(fallBackValue); + resolution.ErrorType.Should().Be(ErrorType.FlagNotFound); + } + + // EvaluateAsync Tests + [Theory] [InlineData(HttpStatusCode.NotFound, ErrorType.FlagNotFound, 0.0)] [InlineData(HttpStatusCode.BadRequest, ErrorType.TypeMismatch, 0.0)] @@ -38,8 +83,8 @@ public async Task EvaluateAsync_GivenHttpRequestException_ShouldHandleHttpReques HttpStatusCode thrownStatusCode, ErrorType expectedOpenFeatureErrorType, double fallbackValue) { var mockFliptClientWrapper = new Mock(); - mockFliptClientWrapper.Setup(ev => - ev.EvaluateVariantAsync(It.IsAny())) + mockFliptClientWrapper.Setup(fcw => + fcw.EvaluateVariantAsync(It.IsAny())) .ThrowsAsync(new HttpRequestException("", null, thrownStatusCode)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); @@ -47,4 +92,81 @@ public async Task EvaluateAsync_GivenHttpRequestException_ShouldHandleHttpReques resolution.Value.Should().Be(fallbackValue); resolution.ErrorType.Should().Be(expectedOpenFeatureErrorType); } + + [Theory] + [InlineData("variant-flag", 1.0, 1.0)] + [InlineData("variant-flag", "thisisastring", "thisisastring")] + [InlineData("variant-flag", 1, 1)] + public async Task EvaluateAsync_GivenExistingVariantFlagWhichIsNotAnObject_ShouldReturnFlagValue(string flagKey, + object valueFromSrc, object? expectedValue = null, string variantAttachment = "") + { + var mockFliptClientWrapper = new Mock(); + mockFliptClientWrapper.Setup(fcw => fcw.EvaluateVariantAsync(It.IsAny())) + .ReturnsAsync(new VariantEvaluationResponse + { + FlagKey = flagKey, + VariantKey = valueFromSrc.ToString() ?? string.Empty, + RequestId = Guid.NewGuid().ToString(), + SegmentKeys = ["segment1"], + VariantAttachment = variantAttachment, + Match = true, + Reason = Reason.MatchEvaluationReason + }); + + var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); + var resolution = await fliptToOpenFeature.EvaluateAsync(flagKey, valueFromSrc); + + resolution.FlagKey.Should().Be(flagKey); + resolution.Variant.Should().Be(valueFromSrc.ToString() ?? string.Empty); + resolution.Value.Should().BeEquivalentTo(expectedValue?.ToString()); + } + + [Fact] + public async Task EvaluateAsync_GivenExistingVariantFlagAndWithAnObject_ShouldReturnFlagValue() + { + const string flagKey = "variant-flag"; + const string variantKey = "variant-A"; + const string valueFromSrc = """ + { + "name": "Mr. Robinson", + "age": 12, + } + """; + var expectedValue = new Value(new Structure(new Dictionary + { + { "name", new Value("Mr. Robinson") }, { "age", new Value(12) } + })); + + var mockFliptClientWrapper = new Mock(); + mockFliptClientWrapper.Setup(fcw => fcw.EvaluateVariantAsync(It.IsAny())) + .ReturnsAsync(new VariantEvaluationResponse + { + FlagKey = flagKey, + VariantKey = variantKey, + RequestId = Guid.NewGuid().ToString(), + SegmentKeys = ["segment1"], + VariantAttachment = valueFromSrc, + Match = true, + Reason = Reason.MatchEvaluationReason + }); + + var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); + var resolution = await fliptToOpenFeature.EvaluateAsync(flagKey, new Value()); + + resolution.FlagKey.Should().Be(flagKey); + resolution.Variant.Should().Be(variantKey); + resolution.Value.Should().BeEquivalentTo(expectedValue); + } + /* Todo Andrei: Mga kulang pa na unit test + - Successful na flag + - Boolean + - Variant and other types + - Wrong flag name + - Boolean + - Variant + - Type mismatch call + + Strategy: + 1. I-mock lang return type ni Flipt + */ } \ No newline at end of file diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs index b56f2c20..fa39cfd8 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs @@ -1,4 +1,9 @@ +using Flipt.DTOs; using FluentAssertions; +using Moq; +using OpenFeature.Constant; +using OpenFeature.Model; +using Reason = Flipt.Models.Reason; namespace OpenFeature.Contrib.Providers.Flipt.Test; @@ -21,4 +26,42 @@ public void CreateFliptProvider_GivenEmptyUrl_ShouldThrowInvalidOperationExcepti act.Should().Throw() .WithMessage("BaseURL must be provided."); } + + + [Fact] + public async Task + ResolveNonBooleansAsync_GivenFlagThatHasATypeMismatch_ShouldReturnDefaultValueWithTypeMismatchError() + { + var mockFliptClientWrapper = new Mock(); + const string flagKey = "iamnotadouble"; + mockFliptClientWrapper.Setup(fcw => fcw.EvaluateVariantAsync(It.IsAny())) + .ReturnsAsync(new VariantEvaluationResponse + { + FlagKey = flagKey, + VariantKey = "iamastring", + RequestId = Guid.NewGuid() + .ToString(), + SegmentKeys = ["segment1"], + VariantAttachment = "", + Match = true, + Reason = Reason.MatchEvaluationReason + }); + + var provider = new FliptProvider(new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object)); + + var doubleResolution = await provider.ResolveDoubleValueAsync(flagKey, 0.0); + doubleResolution.FlagKey.Should().Be(flagKey); + doubleResolution.Value.Should().Be(0.0); + doubleResolution.ErrorType.Should().Be(ErrorType.TypeMismatch); + + var integerResolution = await provider.ResolveIntegerValueAsync(flagKey, 0); + integerResolution.FlagKey.Should().Be(flagKey); + integerResolution.Value.Should().Be(0); + integerResolution.ErrorType.Should().Be(ErrorType.TypeMismatch); + + var valueResolution = await provider.ResolveStructureValueAsync(flagKey, new Value()); + valueResolution.FlagKey.Should().Be(flagKey); + valueResolution.Value.Should().BeEquivalentTo(new Value()); + valueResolution.ErrorType.Should().Be(ErrorType.TypeMismatch); + } } \ No newline at end of file From 10b1d8628693c59a2ff6ae52f462c89c9e53313d Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Wed, 2 Oct 2024 22:12:55 +0200 Subject: [PATCH 15/47] Added FliptToOpenFeatureConverter tests for non-existent flags for Variant types Signed-off-by: Andrei de la Cruz --- ....cs => FliptToOpenFeatureConverterTest.cs} | 44 ++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) rename test/OpenFeature.Contrib.Providers.Flipt.Test/{FlipToOpenFeatureConverterTest.cs => FliptToOpenFeatureConverterTest.cs} (79%) diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipToOpenFeatureConverterTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs similarity index 79% rename from test/OpenFeature.Contrib.Providers.Flipt.Test/FlipToOpenFeatureConverterTest.cs rename to test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs index d86d4ba3..7e63ab08 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipToOpenFeatureConverterTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs @@ -8,7 +8,7 @@ namespace OpenFeature.Contrib.Providers.Flipt.Test; -public class FlipToOpenFeatureConverterTest +public class FliptToOpenFeatureConverterTest { // EvaluateBooleanAsync Tests [Theory] @@ -157,6 +157,48 @@ public async Task EvaluateAsync_GivenExistingVariantFlagAndWithAnObject_ShouldRe resolution.Variant.Should().Be(variantKey); resolution.Value.Should().BeEquivalentTo(expectedValue); } + + + [Fact] + public async Task + EvaluateVariantAsync_GivenNonExistentFlagWithNonNestedFallback_ShouldReturnDefaultValueWithFlagNotFoundError() + { + var fallbackValue = new Value(new Structure(new Dictionary + { + { "name", new Value("Mr. Robinson") }, { "age", new Value(12) } + })); + var mockFliptClientWrapper = new Mock(); + mockFliptClientWrapper.Setup(fcw => fcw.EvaluateVariantAsync(It.IsAny())) + .ThrowsAsync(new HttpRequestException("", null, HttpStatusCode.NotFound)); + + var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); + var resolution = await fliptToOpenFeature.EvaluateAsync("non-existent-flag", fallbackValue); + + resolution.FlagKey.Should().Be("non-existent-flag"); + resolution.Variant.Should().BeNull(); + resolution.Value.Should().BeEquivalentTo(fallbackValue); + resolution.ErrorType.Should().Be(ErrorType.FlagNotFound); + } + + + [Fact] + public async Task + EvaluateVariantAsync_GivenNonExistentFlagWithNestedFallback_ShouldReturnDefaultValueWithFlagNotFoundError() + { + var fallbackValue = new Value(""); + var mockFliptClientWrapper = new Mock(); + mockFliptClientWrapper.Setup(fcw => fcw.EvaluateVariantAsync(It.IsAny())) + .ThrowsAsync(new HttpRequestException("", null, HttpStatusCode.NotFound)); + + var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); + var resolution = await fliptToOpenFeature.EvaluateAsync("non-existent-flag", fallbackValue); + + resolution.FlagKey.Should().Be("non-existent-flag"); + resolution.Variant.Should().BeNull(); + resolution.Value.Should().BeEquivalentTo(fallbackValue); + resolution.ErrorType.Should().Be(ErrorType.FlagNotFound); + } + /* Todo Andrei: Mga kulang pa na unit test - Successful na flag - Boolean From d8d382dfca92c0f2959ca7679a64264c70fc0aae Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Wed, 2 Oct 2024 22:58:06 +0200 Subject: [PATCH 16/47] Update release metadata Signed-off-by: Andrei de la Cruz --- release-please-config.json | 10 +++++++++ ...OpenFeature.Contrib.Providers.Flipt.csproj | 21 ++++++++++++------- .../version.txt | 2 +- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/release-please-config.json b/release-please-config.json index 08143eca..cabbd73f 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -72,6 +72,16 @@ "extra-files": [ "OpenFeature.Contrib.Providers.Statsig.csproj" ] + }, + "src/OpenFeature.Contrib.Providers.Flipt": { + "package-name": "OpenFeature.Contrib.Providers.Flipt", + "release-type": "simple", + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": true, + "versioning": "default", + "extra-files": [ + "OpenFeature.Contrib.Providers.Flipt.csproj" + ] } }, "changelog-sections": [ diff --git a/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj b/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj index a388c868..838292cd 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj +++ b/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj @@ -1,12 +1,19 @@  - - net8.0 - default - + + net8.0 + latest + OpenFeature.Contrib.Providers.Flipt + 0.1.0 + $(VersionNumber) + $(VersionNumber) + $(VersionNumber) + Flipt provider for .NET + Jean Andrei de la Cruz Austria + - - - + + + diff --git a/src/OpenFeature.Contrib.Providers.Flipt/version.txt b/src/OpenFeature.Contrib.Providers.Flipt/version.txt index 8a9ecc2e..6c6aa7cb 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/version.txt +++ b/src/OpenFeature.Contrib.Providers.Flipt/version.txt @@ -1 +1 @@ -0.0.1 \ No newline at end of file +0.1.0 \ No newline at end of file From 204144f6df0dacf46e6d52d34dd6b5a223a853f4 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Wed, 2 Oct 2024 23:24:39 +0200 Subject: [PATCH 17/47] Replaced Flipt package with a generated RestClient from their openapispec Signed-off-by: Andrei de la Cruz --- .../ClientWrapper/FliptClientWrapper.cs | 49 + .../ClientWrapper/IFliptClientWrapper.cs | 23 + .../Flipt.Rest.Client.cs | 6195 +++++++++++++++++ .../FliptClientWrapper.cs | 67 - .../FliptProvider.cs | 9 +- .../FliptToOpenFeatureConverter.cs | 25 +- ...OpenFeature.Contrib.Providers.Flipt.csproj | 2 +- .../openapi.yml | 2225 ++++++ .../FliptProviderTest.cs | 9 +- .../FliptToOpenFeatureConverterTest.cs | 8 +- 10 files changed, 8520 insertions(+), 92 deletions(-) create mode 100644 src/OpenFeature.Contrib.Providers.Flipt/ClientWrapper/FliptClientWrapper.cs create mode 100644 src/OpenFeature.Contrib.Providers.Flipt/ClientWrapper/IFliptClientWrapper.cs create mode 100644 src/OpenFeature.Contrib.Providers.Flipt/Flipt.Rest.Client.cs delete mode 100644 src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs create mode 100644 src/OpenFeature.Contrib.Providers.Flipt/openapi.yml diff --git a/src/OpenFeature.Contrib.Providers.Flipt/ClientWrapper/FliptClientWrapper.cs b/src/OpenFeature.Contrib.Providers.Flipt/ClientWrapper/FliptClientWrapper.cs new file mode 100644 index 00000000..ea332706 --- /dev/null +++ b/src/OpenFeature.Contrib.Providers.Flipt/ClientWrapper/FliptClientWrapper.cs @@ -0,0 +1,49 @@ +using System; +using System.Net.Http; +using System.Threading.Tasks; +using Flipt.Rest; + +namespace OpenFeature.Contrib.Providers.Flipt.ClientWrapper; + +/// +/// Wrapper for Flipt server sdk client for .net +/// +public class FliptClientWrapper : IFliptClientWrapper +{ + private readonly FliptRestClient _fliptRestClient; + + /// + /// + /// Url of flipt instance + /// Authentication access token + /// Timeout when calling flipt endpoints in seconds + public FliptClientWrapper(string fliptUrl, + string clientToken = "", + int timeoutInSeconds = 30) + { + _fliptRestClient = BuildClient(fliptUrl, clientToken, timeoutInSeconds); + } + + /// + public async Task EvaluateVariantAsync(EvaluationRequest evaluationRequest) + { + return await _fliptRestClient.EvaluateV1VariantAsync(evaluationRequest); + } + + /// + public async Task EvaluateBooleanAsync(EvaluationRequest evaluationRequest) + { + return await _fliptRestClient.EvaluateV1BooleanAsync(evaluationRequest); + } + + private static FliptRestClient BuildClient(string fliptUrl, string clientToken, int timeoutInSeconds = 30) + { + var httpClient = new HttpClient + { + BaseAddress = new Uri(fliptUrl), + Timeout = TimeSpan.FromSeconds(timeoutInSeconds), + DefaultRequestHeaders = { { "Authorization", $"Bearer {clientToken}" } } + }; + return new FliptRestClient(httpClient); + } +} \ No newline at end of file diff --git a/src/OpenFeature.Contrib.Providers.Flipt/ClientWrapper/IFliptClientWrapper.cs b/src/OpenFeature.Contrib.Providers.Flipt/ClientWrapper/IFliptClientWrapper.cs new file mode 100644 index 00000000..bd0f0be9 --- /dev/null +++ b/src/OpenFeature.Contrib.Providers.Flipt/ClientWrapper/IFliptClientWrapper.cs @@ -0,0 +1,23 @@ +using System.Threading.Tasks; +using Flipt.Rest; + +namespace OpenFeature.Contrib.Providers.Flipt.ClientWrapper; + +/// +/// +public interface IFliptClientWrapper +{ + /// + /// Wrapper to Flipt.io/EvaluateVariantAsync method + /// + /// + /// + Task EvaluateVariantAsync(EvaluationRequest evaluationRequest); + + /// + /// Wrapper to Flipt.io/EvaluateBooleanAsync method + /// + /// + /// + Task EvaluateBooleanAsync(EvaluationRequest evaluationRequest); +} \ No newline at end of file diff --git a/src/OpenFeature.Contrib.Providers.Flipt/Flipt.Rest.Client.cs b/src/OpenFeature.Contrib.Providers.Flipt/Flipt.Rest.Client.cs new file mode 100644 index 00000000..83c2d331 --- /dev/null +++ b/src/OpenFeature.Contrib.Providers.Flipt/Flipt.Rest.Client.cs @@ -0,0 +1,6195 @@ +//---------------------- +// +// Generated using the NSwag toolchain v14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) +// +//---------------------- + +#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended." +#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." +#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?' +#pragma warning disable 612 // Disable "CS0612 '...' is obsolete" +#pragma warning disable 649 // Disable "CS0649 Field is never assigned to, and will always have its default value null" +#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ... +#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..." +#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'" +#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant" +#pragma warning disable 8603 // Disable "CS8603 Possible null reference return" +#pragma warning disable 8604 // Disable "CS8604 Possible null reference argument for parameter" +#pragma warning disable 8625 // Disable "CS8625 Cannot convert null literal to non-nullable reference type" +#pragma warning disable 8765 // Disable "CS8765 Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes)." + +namespace Flipt.Rest +{ + using System = global::System; + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface IFliptRestClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task EvaluateV1BooleanAsync(EvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task EvaluateV1VariantAsync(EvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task EvaluateV1BatchAsync(BatchEvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task AuthV1MethodKubernetesServiceaccountAsync(Body body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task AuthV1MethodOidcAuthorizeAsync(string provider, string state, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task AuthV1MethodOidcCallbackAsync(string provider, string code, string state, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task AuthV1MethodTokenAsync(Body2 body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task AuthV1TokensGetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task AuthV1TokensGetAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task AuthV1TokensDeleteAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task AuthV1SelfAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task AuthV1SelfExpireAsync(Body3 body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsPostAsync(string namespaceKey, string segmentKey, ConstraintCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsDeleteAsync(string namespaceKey, string segmentKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsPutAsync(string namespaceKey, string segmentKey, string id, ConstraintUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsPostAsync(string namespaceKey, string flagKey, string ruleId, DistributionCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsDeleteAsync(string namespaceKey, string flagKey, string ruleId, string id, string variantId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsPutAsync(string namespaceKey, string flagKey, string ruleId, string id, DistributionUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesEvaluateAsync(string namespaceKey, EvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesBatchEvaluateAsync(string namespaceKey, BatchEvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesFlagsGetAsync(string namespaceKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesFlagsPostAsync(string namespaceKey, FlagCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesFlagsGetAsync(string namespaceKey, string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesFlagsDeleteAsync(string namespaceKey, string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesFlagsPutAsync(string namespaceKey, string key, FlagUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesGetAsync(int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesPostAsync(NamespaceCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesGetAsync(string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesDeleteAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesPutAsync(string key, NamespaceUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsGetAsync(string namespaceKey, string flagKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsPostAsync(string namespaceKey, string flagKey, RolloutCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsOrderAsync(string namespaceKey, string flagKey, RolloutOrderRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsGetAsync(string namespaceKey, string flagKey, string id, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsPutAsync(string namespaceKey, string flagKey, string id, RolloutUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesGetAsync(string namespaceKey, string flagKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesPostAsync(string namespaceKey, string flagKey, RuleCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesOrderAsync(string namespaceKey, string flagKey, RuleOrderRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesGetAsync(string namespaceKey, string flagKey, string id, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesPutAsync(string namespaceKey, string flagKey, string id, RuleUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesSegmentsGetAsync(string namespaceKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesSegmentsPostAsync(string namespaceKey, SegmentCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesSegmentsGetAsync(string namespaceKey, string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesSegmentsDeleteAsync(string namespaceKey, string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesSegmentsPutAsync(string namespaceKey, string key, SegmentUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsPostAsync(string namespaceKey, string flagKey, VariantCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsPutAsync(string namespaceKey, string flagKey, string id, VariantUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class FliptRestClient : IFliptRestClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public FliptRestClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task EvaluateV1BooleanAsync(EvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "evaluate/v1/boolean" + urlBuilder_.Append("evaluate/v1/boolean"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task EvaluateV1VariantAsync(EvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "evaluate/v1/variant" + urlBuilder_.Append("evaluate/v1/variant"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task EvaluateV1BatchAsync(BatchEvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "evaluate/v1/batch" + urlBuilder_.Append("evaluate/v1/batch"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task AuthV1MethodKubernetesServiceaccountAsync(Body body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "auth/v1/method/kubernetes/serviceaccount" + urlBuilder_.Append("auth/v1/method/kubernetes/serviceaccount"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task AuthV1MethodOidcAuthorizeAsync(string provider, string state, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (provider == null) + throw new System.ArgumentNullException("provider"); + + if (state == null) + throw new System.ArgumentNullException("state"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "auth/v1/method/oidc/{provider}/authorize" + urlBuilder_.Append("auth/v1/method/oidc/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(provider, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/authorize"); + urlBuilder_.Append('?'); + urlBuilder_.Append(System.Uri.EscapeDataString("state")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(state, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task AuthV1MethodOidcCallbackAsync(string provider, string code, string state, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (provider == null) + throw new System.ArgumentNullException("provider"); + + if (code == null) + throw new System.ArgumentNullException("code"); + + if (state == null) + throw new System.ArgumentNullException("state"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "auth/v1/method/oidc/{provider}/callback" + urlBuilder_.Append("auth/v1/method/oidc/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(provider, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/callback"); + urlBuilder_.Append('?'); + urlBuilder_.Append(System.Uri.EscapeDataString("code")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(code, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + urlBuilder_.Append(System.Uri.EscapeDataString("state")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(state, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task AuthV1MethodTokenAsync(Body2 body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "auth/v1/method/token" + urlBuilder_.Append("auth/v1/method/token"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task AuthV1TokensGetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "auth/v1/tokens" + urlBuilder_.Append("auth/v1/tokens"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task AuthV1TokensGetAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "auth/v1/tokens/{id}" + urlBuilder_.Append("auth/v1/tokens/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task AuthV1TokensDeleteAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "auth/v1/tokens/{id}" + urlBuilder_.Append("auth/v1/tokens/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task AuthV1SelfAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "auth/v1/self" + urlBuilder_.Append("auth/v1/self"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task AuthV1SelfExpireAsync(Body3 body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PUT"); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "auth/v1/self/expire" + urlBuilder_.Append("auth/v1/self/expire"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsPostAsync(string namespaceKey, string segmentKey, ConstraintCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (segmentKey == null) + throw new System.ArgumentNullException("segmentKey"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/segments/{segmentKey}/constraints" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/segments/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(segmentKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/constraints"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsDeleteAsync(string namespaceKey, string segmentKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (segmentKey == null) + throw new System.ArgumentNullException("segmentKey"); + + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/segments/{segmentKey}/constraints/{id}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/segments/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(segmentKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/constraints/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsPutAsync(string namespaceKey, string segmentKey, string id, ConstraintUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (segmentKey == null) + throw new System.ArgumentNullException("segmentKey"); + + if (id == null) + throw new System.ArgumentNullException("id"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PUT"); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/segments/{segmentKey}/constraints/{id}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/segments/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(segmentKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/constraints/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsPostAsync(string namespaceKey, string flagKey, string ruleId, DistributionCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + if (ruleId == null) + throw new System.ArgumentNullException("ruleId"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{ruleId}/distributions" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rules/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(ruleId, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/distributions"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsDeleteAsync(string namespaceKey, string flagKey, string ruleId, string id, string variantId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + if (ruleId == null) + throw new System.ArgumentNullException("ruleId"); + + if (id == null) + throw new System.ArgumentNullException("id"); + + if (variantId == null) + throw new System.ArgumentNullException("variantId"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{ruleId}/distributions/{id}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rules/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(ruleId, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/distributions/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append('?'); + urlBuilder_.Append(System.Uri.EscapeDataString("variantId")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(variantId, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsPutAsync(string namespaceKey, string flagKey, string ruleId, string id, DistributionUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + if (ruleId == null) + throw new System.ArgumentNullException("ruleId"); + + if (id == null) + throw new System.ArgumentNullException("id"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PUT"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{ruleId}/distributions/{id}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rules/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(ruleId, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/distributions/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesEvaluateAsync(string namespaceKey, EvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/evaluate" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/evaluate"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesBatchEvaluateAsync(string namespaceKey, BatchEvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/batch-evaluate" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/batch-evaluate"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsGetAsync(string namespaceKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags"); + urlBuilder_.Append('?'); + if (limit != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (offset != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (pageToken != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("pageToken")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(pageToken, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (reference != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsPostAsync(string namespaceKey, FlagCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsGetAsync(string namespaceKey, string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (key == null) + throw new System.ArgumentNullException("key"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{key}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append('?'); + if (reference != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsDeleteAsync(string namespaceKey, string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (key == null) + throw new System.ArgumentNullException("key"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{key}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsPutAsync(string namespaceKey, string key, FlagUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (key == null) + throw new System.ArgumentNullException("key"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PUT"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{key}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesGetAsync(int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces" + urlBuilder_.Append("api/v1/namespaces"); + urlBuilder_.Append('?'); + if (limit != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (offset != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (pageToken != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("pageToken")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(pageToken, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (reference != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesPostAsync(NamespaceCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces" + urlBuilder_.Append("api/v1/namespaces"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesGetAsync(string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (key == null) + throw new System.ArgumentNullException("key"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{key}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append('?'); + if (reference != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesDeleteAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (key == null) + throw new System.ArgumentNullException("key"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{key}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesPutAsync(string key, NamespaceUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (key == null) + throw new System.ArgumentNullException("key"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PUT"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{key}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsGetAsync(string namespaceKey, string flagKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rollouts"); + urlBuilder_.Append('?'); + if (limit != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (offset != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (pageToken != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("pageToken")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(pageToken, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (reference != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsPostAsync(string namespaceKey, string flagKey, RolloutCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rollouts"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsOrderAsync(string namespaceKey, string flagKey, RolloutOrderRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PUT"); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts/order" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rollouts/order"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsGetAsync(string namespaceKey, string flagKey, string id, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts/{id}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rollouts/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append('?'); + if (reference != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts/{id}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rollouts/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsPutAsync(string namespaceKey, string flagKey, string id, RolloutUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + if (id == null) + throw new System.ArgumentNullException("id"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PUT"); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts/{id}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rollouts/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesGetAsync(string namespaceKey, string flagKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rules"); + urlBuilder_.Append('?'); + if (limit != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (offset != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (pageToken != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("pageToken")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(pageToken, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (reference != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesPostAsync(string namespaceKey, string flagKey, RuleCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rules"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesOrderAsync(string namespaceKey, string flagKey, RuleOrderRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PUT"); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/order" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rules/order"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesGetAsync(string namespaceKey, string flagKey, string id, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{id}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rules/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append('?'); + if (reference != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{id}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rules/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesPutAsync(string namespaceKey, string flagKey, string id, RuleUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + if (id == null) + throw new System.ArgumentNullException("id"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PUT"); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{id}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rules/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsGetAsync(string namespaceKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/segments" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/segments"); + urlBuilder_.Append('?'); + if (limit != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (offset != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (pageToken != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("pageToken")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(pageToken, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (reference != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsPostAsync(string namespaceKey, SegmentCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/segments" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/segments"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsGetAsync(string namespaceKey, string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (key == null) + throw new System.ArgumentNullException("key"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/segments/{key}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/segments/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append('?'); + if (reference != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsDeleteAsync(string namespaceKey, string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (key == null) + throw new System.ArgumentNullException("key"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/segments/{key}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/segments/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsPutAsync(string namespaceKey, string key, SegmentUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (key == null) + throw new System.ArgumentNullException("key"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PUT"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/segments/{key}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/segments/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsPostAsync(string namespaceKey, string flagKey, VariantCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/variants" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/variants"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/variants/{id}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/variants/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsPutAsync(string namespaceKey, string flagKey, string id, VariantUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + if (id == null) + throw new System.ArgumentNullException("id"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PUT"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/variants/{id}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/variants/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new FliptException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new FliptException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record EvaluationRequest + { + + [System.Text.Json.Serialization.JsonPropertyName("requestId")] + public string RequestId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string NamespaceKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("flagKey")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string FlagKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("entityId")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string EntityId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("context")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.IDictionary Context { get; set; } = new System.Collections.Generic.Dictionary(); + + [System.Text.Json.Serialization.JsonPropertyName("reference")] + public string Reference { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum EvaluationResponseType + { + + [System.Runtime.Serialization.EnumMember(Value = @"VARIANT_EVALUATION_RESPONSE_TYPE")] + VARIANT_EVALUATION_RESPONSE_TYPE = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"BOOLEAN_EVALUATION_RESPONSE_TYPE")] + BOOLEAN_EVALUATION_RESPONSE_TYPE = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"ERROR_EVALUATION_RESPONSE_TYPE")] + ERROR_EVALUATION_RESPONSE_TYPE = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record EvaluationResponse + { + + [System.Text.Json.Serialization.JsonPropertyName("type")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public EvaluationResponseType Type { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("booleanResponse")] + public BooleanEvaluationResponse BooleanResponse { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("variantResponse")] + public VariantEvaluationResponse VariantResponse { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("errorResponse")] + public ErrorEvaluationResponse ErrorResponse { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record ErrorEvaluationResponse + { + + [System.Text.Json.Serialization.JsonPropertyName("flagKey")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string FlagKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string NamespaceKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("reason")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public ErrorEvaluationReason Reason { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record BooleanEvaluationResponse + { + + [System.Text.Json.Serialization.JsonPropertyName("requestId")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string RequestId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("flagKey")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string FlagKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("enabled")] + public bool Enabled { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("timestamp")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public System.DateTimeOffset Timestamp { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("requestDurationMillis")] + public double RequestDurationMillis { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("reason")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public EvaluationReason Reason { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record VariantEvaluationResponse + { + + [System.Text.Json.Serialization.JsonPropertyName("requestId")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string RequestId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("match")] + public bool Match { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("flagKey")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string FlagKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("segmentKeys")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection SegmentKeys { get; set; } = new System.Collections.ObjectModel.Collection(); + + [System.Text.Json.Serialization.JsonPropertyName("variantKey")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string VariantKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("variantAttachment")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string VariantAttachment { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("timestamp")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public System.DateTimeOffset Timestamp { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("requestDurationMillis")] + public double RequestDurationMillis { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("reason")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public EvaluationReason Reason { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum EvaluationReason + { + + [System.Runtime.Serialization.EnumMember(Value = @"UNKNOWN_EVALUATION_REASON")] + UNKNOWN_EVALUATION_REASON = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"FLAG_DISABLED_EVALUATION_REASON")] + FLAG_DISABLED_EVALUATION_REASON = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"MATCH_EVALUATION_REASON")] + MATCH_EVALUATION_REASON = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"DEFAULT_EVALUATION_REASON")] + DEFAULT_EVALUATION_REASON = 3, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum ErrorEvaluationReason + { + + [System.Runtime.Serialization.EnumMember(Value = @"UNKNOWN_ERROR_EVALUATION_REASON")] + UNKNOWN_ERROR_EVALUATION_REASON = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"NOT_FOUND_ERROR_EVALUATION_REASON")] + NOT_FOUND_ERROR_EVALUATION_REASON = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record BatchEvaluationRequest + { + + [System.Text.Json.Serialization.JsonPropertyName("requestId")] + public string RequestId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("requests")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Requests { get; set; } = new System.Collections.ObjectModel.Collection(); + + [System.Text.Json.Serialization.JsonPropertyName("reference")] + public string Reference { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record BatchEvaluationResponse + { + + [System.Text.Json.Serialization.JsonPropertyName("requestId")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string RequestId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("responses")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Responses { get; set; } = new System.Collections.ObjectModel.Collection(); + + [System.Text.Json.Serialization.JsonPropertyName("requestDurationMillis")] + public double RequestDurationMillis { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record AuthMethodOIDCAuthorizeURLResponse + { + + [System.Text.Json.Serialization.JsonPropertyName("authorizeUrl")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string AuthorizeUrl { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record AuthMethodOIDCCallbackResponse + { + + [System.Text.Json.Serialization.JsonPropertyName("authentication")] + [System.ComponentModel.DataAnnotations.Required] + public Authentication Authentication { get; set; } = new Authentication(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// The default is METHOD_NONE + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum AuthenticationMethod + { + + [System.Runtime.Serialization.EnumMember(Value = @"METHOD_NONE")] + METHOD_NONE = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"METHOD_TOKEN")] + METHOD_TOKEN = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"METHOD_OIDC")] + METHOD_OIDC = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"METHOD_KUBERNETES")] + METHOD_KUBERNETES = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"METHOD_JWT")] + METHOD_JWT = 4, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record Authentication + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("method")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public AuthenticationMethod Method { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("createdAt")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public System.DateTimeOffset CreatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public System.DateTimeOffset UpdatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("expiresAt")] + public System.DateTimeOffset ExpiresAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("metadata")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.IDictionary Metadata { get; set; } = new System.Collections.Generic.Dictionary(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record AuthenticationList + { + + [System.Text.Json.Serialization.JsonPropertyName("authentications")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Authentications { get; set; } = new System.Collections.ObjectModel.Collection(); + + [System.Text.Json.Serialization.JsonPropertyName("nextPageToken")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string NextPageToken { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record AuthenticationToken + { + + [System.Text.Json.Serialization.JsonPropertyName("clientToken")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string ClientToken { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("authentication")] + [System.ComponentModel.DataAnnotations.Required] + public Authentication Authentication { get; set; } = new Authentication(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record CommonsPageable + { + + [System.Text.Json.Serialization.JsonPropertyName("nextPageToken")] + public string NextPageToken { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("totalCount")] + public int TotalCount { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// The default is UNKNOWN_COMPARISON_TYPE + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum ConstraintComparisonType + { + + [System.Runtime.Serialization.EnumMember(Value = @"UNKNOWN_COMPARISON_TYPE")] + UNKNOWN_COMPARISON_TYPE = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"STRING_COMPARISON_TYPE")] + STRING_COMPARISON_TYPE = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"NUMBER_COMPARISON_TYPE")] + NUMBER_COMPARISON_TYPE = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"BOOLEAN_COMPARISON_TYPE")] + BOOLEAN_COMPARISON_TYPE = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"DATETIME_COMPARISON_TYPE")] + DATETIME_COMPARISON_TYPE = 4, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record Constraint + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string NamespaceKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("segmentKey")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string SegmentKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("type")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public ConstraintComparisonType Type { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("property")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Property { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("operator")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Operator { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("value")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Value { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("description")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Description { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("createdAt")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public System.DateTimeOffset CreatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public System.DateTimeOffset UpdatedAt { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record ConstraintCreateRequest + { + + [System.Text.Json.Serialization.JsonPropertyName("type")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public ConstraintComparisonType Type { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("property")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Property { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("operator")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Operator { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("value")] + public string Value { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("description")] + public string Description { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record ConstraintUpdateRequest + { + + [System.Text.Json.Serialization.JsonPropertyName("type")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public ConstraintComparisonType Type { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("property")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Property { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("operator")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Operator { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("value")] + public string Value { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("description")] + public string Description { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record Distribution + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("ruleId")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string RuleId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("variantId")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string VariantId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("rollout")] + public double Rollout { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("createdAt")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public System.DateTimeOffset CreatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public System.DateTimeOffset UpdatedAt { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record DistributionCreateRequest + { + + [System.Text.Json.Serialization.JsonPropertyName("variantId")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string VariantId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("rollout")] + public double Rollout { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record DistributionUpdateRequest + { + + [System.Text.Json.Serialization.JsonPropertyName("variantId")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string VariantId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("rollout")] + public double Rollout { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record FlagList + { + + [System.Text.Json.Serialization.JsonPropertyName("flags")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Flags { get; set; } = new System.Collections.ObjectModel.Collection(); + + [System.Text.Json.Serialization.JsonPropertyName("nextPageToken")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string NextPageToken { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("totalCount")] + public int TotalCount { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record Flag + { + + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string NamespaceKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("key")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Key { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("description")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Description { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("enabled")] + public bool Enabled { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("createdAt")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public System.DateTimeOffset CreatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public System.DateTimeOffset UpdatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("variants")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Variants { get; set; } = new System.Collections.ObjectModel.Collection(); + + [System.Text.Json.Serialization.JsonPropertyName("type")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public FlagType Type { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("defaultVariant")] + public Variant DefaultVariant { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum FlagType + { + + [System.Runtime.Serialization.EnumMember(Value = @"VARIANT_FLAG_TYPE")] + VARIANT_FLAG_TYPE = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"BOOLEAN_FLAG_TYPE")] + BOOLEAN_FLAG_TYPE = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record FlagCreateRequest + { + + [System.Text.Json.Serialization.JsonPropertyName("key")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Key { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("description")] + public string Description { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("enabled")] + public bool Enabled { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("type")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public FlagType Type { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record FlagUpdateRequest + { + + [System.Text.Json.Serialization.JsonPropertyName("name")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("description")] + public string Description { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("enabled")] + public bool Enabled { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("defaultVariantId")] + public string DefaultVariantId { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record NamespaceList + { + + [System.Text.Json.Serialization.JsonPropertyName("namespaces")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Namespaces { get; set; } = new System.Collections.ObjectModel.Collection(); + + [System.Text.Json.Serialization.JsonPropertyName("nextPageToken")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string NextPageToken { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("totalCount")] + public int TotalCount { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record Namespace + { + + [System.Text.Json.Serialization.JsonPropertyName("key")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Key { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("description")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Description { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("protected")] + public bool Protected { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("createdAt")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public System.DateTimeOffset CreatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public System.DateTimeOffset UpdatedAt { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record NamespaceCreateRequest + { + + [System.Text.Json.Serialization.JsonPropertyName("key")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Key { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("description")] + public string Description { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record NamespaceUpdateRequest + { + + [System.Text.Json.Serialization.JsonPropertyName("name")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("description")] + public string Description { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record RolloutList + { + + [System.Text.Json.Serialization.JsonPropertyName("rollouts")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Rollouts { get; set; } = new System.Collections.ObjectModel.Collection(); + + [System.Text.Json.Serialization.JsonPropertyName("nextPageToken")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string NextPageToken { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("totalCount")] + public int TotalCount { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record Rollout + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string NamespaceKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("flagKey")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string FlagKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("type")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public RolloutType Type { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("rank")] + public int Rank { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("description")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Description { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("createdAt")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public System.DateTimeOffset CreatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public System.DateTimeOffset UpdatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("segment")] + public RolloutSegment Segment { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("threshold")] + public RolloutThreshold Threshold { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum RolloutSegmentOperator + { + + [System.Runtime.Serialization.EnumMember(Value = @"OR_SEGMENT_OPERATOR")] + OR_SEGMENT_OPERATOR = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"AND_SEGMENT_OPERATOR")] + AND_SEGMENT_OPERATOR = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum RolloutType + { + + [System.Runtime.Serialization.EnumMember(Value = @"UNKNOWN_ROLLOUT_TYPE")] + UNKNOWN_ROLLOUT_TYPE = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"SEGMENT_ROLLOUT_TYPE")] + SEGMENT_ROLLOUT_TYPE = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"THRESHOLD_ROLLOUT_TYPE")] + THRESHOLD_ROLLOUT_TYPE = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record RolloutSegment + { + + [System.Text.Json.Serialization.JsonPropertyName("segmentKey")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string SegmentKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("segmentKeys")] + public System.Collections.Generic.ICollection SegmentKeys { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("segmentOperator")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public RolloutSegmentOperator SegmentOperator { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("value")] + public bool Value { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record RolloutThreshold + { + + [System.Text.Json.Serialization.JsonPropertyName("percentage")] + public double Percentage { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("value")] + public bool Value { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record RolloutCreateRequest + { + + [System.Text.Json.Serialization.JsonPropertyName("rank")] + public int Rank { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("description")] + public string Description { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("segment")] + public RolloutSegment Segment { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("threshold")] + public RolloutThreshold Threshold { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record RolloutUpdateRequest + { + + [System.Text.Json.Serialization.JsonPropertyName("description")] + public string Description { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("segment")] + public RolloutSegment Segment { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("threshold")] + public RolloutThreshold Threshold { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record RolloutOrderRequest + { + + [System.Text.Json.Serialization.JsonPropertyName("rolloutIds")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection RolloutIds { get; set; } = new System.Collections.ObjectModel.Collection(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record RuleList + { + + [System.Text.Json.Serialization.JsonPropertyName("rules")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Rules { get; set; } = new System.Collections.ObjectModel.Collection(); + + [System.Text.Json.Serialization.JsonPropertyName("nextPageToken")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string NextPageToken { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("totalCount")] + public int TotalCount { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum RuleSegmentOperator + { + + [System.Runtime.Serialization.EnumMember(Value = @"OR_SEGMENT_OPERATOR")] + OR_SEGMENT_OPERATOR = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"AND_SEGMENT_OPERATOR")] + AND_SEGMENT_OPERATOR = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record Rule + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string NamespaceKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("flagKey")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string FlagKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("segmentKey")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string SegmentKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("segmentKeys")] + public System.Collections.Generic.ICollection SegmentKeys { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("segmentOperator")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public RuleSegmentOperator SegmentOperator { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("distributions")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Distributions { get; set; } = new System.Collections.ObjectModel.Collection(); + + [System.Text.Json.Serialization.JsonPropertyName("rank")] + public int Rank { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("createdAt")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public System.DateTimeOffset CreatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public System.DateTimeOffset UpdatedAt { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record RuleCreateRequest + { + + [System.Text.Json.Serialization.JsonPropertyName("segmentKey")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string SegmentKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("segmentKeys")] + public System.Collections.Generic.ICollection SegmentKeys { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("segmentOperator")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public RuleSegmentOperator SegmentOperator { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("rank")] + public int Rank { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record RuleOrderRequest + { + + [System.Text.Json.Serialization.JsonPropertyName("ruleIds")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection RuleIds { get; set; } = new System.Collections.ObjectModel.Collection(); + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record RuleUpdateRequest + { + + [System.Text.Json.Serialization.JsonPropertyName("segmentKey")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string SegmentKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("segmentKeys")] + public System.Collections.Generic.ICollection SegmentKeys { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("segmentOperator")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public RuleSegmentOperator SegmentOperator { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record SegmentList + { + + [System.Text.Json.Serialization.JsonPropertyName("segments")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Segments { get; set; } = new System.Collections.ObjectModel.Collection(); + + [System.Text.Json.Serialization.JsonPropertyName("nextPageToken")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string NextPageToken { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("totalCount")] + public int TotalCount { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record Segment + { + + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string NamespaceKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("key")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Key { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("description")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Description { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("createdAt")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public System.DateTimeOffset CreatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public System.DateTimeOffset UpdatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("constraints")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Constraints { get; set; } = new System.Collections.ObjectModel.Collection(); + + [System.Text.Json.Serialization.JsonPropertyName("matchType")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public SegmentMatchType MatchType { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum SegmentMatchType + { + + [System.Runtime.Serialization.EnumMember(Value = @"ALL_MATCH_TYPE")] + ALL_MATCH_TYPE = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"ANY_MATCH_TYPE")] + ANY_MATCH_TYPE = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record SegmentCreateRequest + { + + [System.Text.Json.Serialization.JsonPropertyName("key")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Key { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("description")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Description { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("matchType")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public SegmentMatchType MatchType { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record SegmentUpdateRequest + { + + [System.Text.Json.Serialization.JsonPropertyName("name")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("description")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Description { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("matchType")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public SegmentMatchType MatchType { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record Variant + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string NamespaceKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("flagKey")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string FlagKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("key")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Key { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("description")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Description { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("createdAt")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public System.DateTimeOffset CreatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public System.DateTimeOffset UpdatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("attachment")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Attachment { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record VariantCreateRequest + { + + [System.Text.Json.Serialization.JsonPropertyName("key")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Key { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("description")] + public string Description { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("attachment")] + public string Attachment { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record VariantUpdateRequest + { + + [System.Text.Json.Serialization.JsonPropertyName("key")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Key { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("description")] + public string Description { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("attachment")] + public string Attachment { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record Body + { + + [System.Text.Json.Serialization.JsonPropertyName("serviceAccountToken")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string ServiceAccountToken { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record Body2 + { + + [System.Text.Json.Serialization.JsonPropertyName("name")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + public string NamespaceKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("description")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Description { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("expiresAt")] + public System.DateTimeOffset ExpiresAt { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record Body3 + { + + [System.Text.Json.Serialization.JsonPropertyName("expiresAt")] + public System.DateTimeOffset ExpiresAt { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class FliptException : System.Exception + { + public int StatusCode { get; private set; } + + public string Response { get; private set; } + + public System.Collections.Generic.IReadOnlyDictionary> Headers { get; private set; } + + public FliptException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Exception innerException) + : base(message + "\n\nStatus: " + statusCode + "\nResponse: \n" + ((response == null) ? "(null)" : response.Substring(0, response.Length >= 512 ? 512 : response.Length)), innerException) + { + StatusCode = statusCode; + Response = response; + Headers = headers; + } + + public override string ToString() + { + return string.Format("HTTP Response: \n\n{0}\n\n{1}", Response, base.ToString()); + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class FliptException : FliptException + { + public TResult Result { get; private set; } + + public FliptException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, TResult result, System.Exception innerException) + : base(message, statusCode, response, headers, innerException) + { + Result = result; + } + } + +} + +#pragma warning restore 108 +#pragma warning restore 114 +#pragma warning restore 472 +#pragma warning restore 612 +#pragma warning restore 1573 +#pragma warning restore 1591 +#pragma warning restore 8073 +#pragma warning restore 3016 +#pragma warning restore 8603 +#pragma warning restore 8604 +#pragma warning restore 8625 \ No newline at end of file diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs deleted file mode 100644 index 3d8235d6..00000000 --- a/src/OpenFeature.Contrib.Providers.Flipt/FliptClientWrapper.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System.Threading.Tasks; -using Flipt.Authentication; -using Flipt.Clients; -using Flipt.DTOs; -using Flipt.Utilities; - -namespace OpenFeature.Contrib.Providers.Flipt; - -/// -/// Wrapper for Flipt server sdk client for .net -/// -public class FliptClientWrapper : IFliptClientWrapper -{ - private readonly Evaluation _fliptEvaluationClient; - - /// - /// - /// Url of flipt instance - /// Authentication access token - /// Timeout when calling flipt endpoints in seconds - public FliptClientWrapper(string fliptUrl, - string clientToken = "", - int timeoutInSeconds = 30) - { - _fliptEvaluationClient = BuildClient(fliptUrl, clientToken, timeoutInSeconds).Evaluation; - } - - /// - public async Task EvaluateVariantAsync(EvaluationRequest evaluationRequest) - { - return await _fliptEvaluationClient.EvaluateVariantAsync(evaluationRequest); - } - - /// - public async Task EvaluateBooleanAsync(EvaluationRequest evaluationRequest) - { - return await _fliptEvaluationClient.EvaluateBooleanAsync(evaluationRequest); - } - - private static FliptClient BuildClient(string fliptUrl, string clientToken, int timeoutInSeconds = 30) - { - return FliptClient.Builder() - .WithUrl(fliptUrl) - .WithAuthentication(new ClientTokenAuthenticationStrategy(clientToken)) - .WithTimeout(timeoutInSeconds) - .Build(); - } -} - -/// -/// -public interface IFliptClientWrapper -{ - /// - /// Wrapper to Flipt.io/EvaluateVariantAsync method - /// - /// - /// - Task EvaluateVariantAsync(EvaluationRequest evaluationRequest); - - /// - /// Wrapper to Flipt.io/EvaluateBooleanAsync method - /// - /// - /// - Task EvaluateBooleanAsync(EvaluationRequest evaluationRequest); -} \ No newline at end of file diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptProvider.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptProvider.cs index d34a06ba..9c09e4b2 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/FliptProvider.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptProvider.cs @@ -8,12 +8,6 @@ namespace OpenFeature.Contrib.Providers.Flipt; /// FliptProvider is the .NET provider implementation for Flipt.io /// /// -/// -/// Url of flipt instance -/// Namespace used for querying flags -/// Authentication access token -/// Timeout when calling flipt endpoints in seconds -/// /// Accepts an instantiated IFliptClientWrapper instance /// /// @@ -29,7 +23,8 @@ public class FliptProvider(IFliptToOpenFeatureConverter fliptToOpenFeatureConver /// Authentication access token /// Timeout when calling flipt endpoints in seconds public FliptProvider(string fliptUrl, string namespaceKey = "default", string clientToken = "", - int timeoutInSeconds = 30) : this(new FliptToOpenFeatureConverter(fliptUrl, namespaceKey, clientToken, timeoutInSeconds)) + int timeoutInSeconds = 30) : this(new FliptToOpenFeatureConverter(fliptUrl, namespaceKey, clientToken, + timeoutInSeconds)) { } diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs index e7b6213d..fd1ca010 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs @@ -3,11 +3,11 @@ using System.Net.Http; using System.Text.Json; using System.Threading.Tasks; -using Flipt.DTOs; +using Flipt.Rest; using OpenFeature.Constant; +using OpenFeature.Contrib.Providers.Flipt.ClientWrapper; using OpenFeature.Contrib.Providers.Flipt.Converters; using OpenFeature.Model; -using Reason = Flipt.Models.Reason; namespace OpenFeature.Contrib.Providers.Flipt; @@ -36,14 +36,19 @@ public FliptToOpenFeatureConverter(string fliptUrl, public async Task> EvaluateAsync(string flagKey, T defaultValue, EvaluationContext context = null) { - var evaluationRequest = new EvaluationRequest(namespaceKey, flagKey, context?.TargetingKey ?? "", - context.ToStringDictionary()); + var evaluationRequest = new EvaluationRequest + { + NamespaceKey = namespaceKey, + FlagKey = flagKey, + EntityId = context?.TargetingKey ?? "", + Context = context.ToStringDictionary() + }; try { var evaluationResponse = await fliptClientWrapper.EvaluateVariantAsync(evaluationRequest); - if (evaluationResponse.Reason == Reason.FlagDisabledEvaluationReason) + if (evaluationResponse.Reason == EvaluationReason.FLAG_DISABLED_EVALUATION_REASON) return new ResolutionDetails(flagKey, defaultValue, ErrorType.None, evaluationResponse.Reason.ToString()); @@ -87,9 +92,13 @@ public async Task> EvaluateBooleanAsync(string flagKey, { try { - var evaluationRequest = new EvaluationRequest(namespaceKey, flagKey, context?.TargetingKey ?? "", - context.ToStringDictionary()); - + var evaluationRequest = new EvaluationRequest + { + NamespaceKey = namespaceKey, + FlagKey = flagKey, + EntityId = context?.TargetingKey ?? "", + Context = context.ToStringDictionary() + }; var boolEvaluationResponse = await fliptClientWrapper.EvaluateBooleanAsync(evaluationRequest); return new ResolutionDetails(flagKey, boolEvaluationResponse.Enabled, ErrorType.None, boolEvaluationResponse.Reason.ToString()); diff --git a/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj b/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj index 838292cd..4f3f22f4 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj +++ b/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj @@ -13,7 +13,7 @@ - + diff --git a/src/OpenFeature.Contrib.Providers.Flipt/openapi.yml b/src/OpenFeature.Contrib.Providers.Flipt/openapi.yml new file mode 100644 index 00000000..dbfa9d79 --- /dev/null +++ b/src/OpenFeature.Contrib.Providers.Flipt/openapi.yml @@ -0,0 +1,2225 @@ +openapi: 3.0.1 +info: + title: api + version: 1.46.0 +paths: + /evaluate/v1/boolean: + post: + operationId: EvaluationService.boolean + tags: + - EvaluationService + parameters: [] + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/BooleanEvaluationResponse" + security: &ref_0 + - BearerAuth: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/EvaluationRequest" + /evaluate/v1/variant: + post: + operationId: EvaluationService.variant + tags: + - EvaluationService + parameters: [] + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/VariantEvaluationResponse" + security: *ref_0 + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/EvaluationRequest" + /evaluate/v1/batch: + post: + operationId: EvaluationService.batch + tags: + - EvaluationService + parameters: [] + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/BatchEvaluationResponse" + security: *ref_0 + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/BatchEvaluationRequest" + /auth/v1/method/kubernetes/serviceaccount: + post: + operationId: AuthMethodK8SService.verifyServiceAccount + tags: + - AuthMethodK8SService + parameters: [] + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/AuthenticationToken" + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + serviceAccountToken: + type: string + required: + - serviceAccountToken + /auth/v1/method/oidc/{provider}/authorize: + get: + operationId: AuthMethodOIDCService.authorizeURL + tags: + - AuthMethodOIDCService + parameters: + - name: provider + in: path + required: true + schema: + type: string + - name: state + in: query + required: true + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/AuthMethodOIDCAuthorizeURLResponse" + /auth/v1/method/oidc/{provider}/callback: + get: + operationId: AuthMethodOIDCService.callback + tags: + - AuthMethodOIDCService + parameters: + - name: provider + in: path + required: true + schema: + type: string + - name: code + in: query + required: true + schema: + type: string + - name: state + in: query + required: true + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/AuthMethodOIDCCallbackResponse" + /auth/v1/method/token: + post: + operationId: AuthMethodTokenService.createToken + tags: + - AuthMethodTokenService + parameters: [] + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/AuthenticationToken" + security: *ref_0 + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + name: + type: string + namespaceKey: + type: string + description: + type: string + expiresAt: + type: string + format: date-time + required: + - name + - description + /auth/v1/tokens: + get: + operationId: AuthService.listTokens + tags: + - AuthService + parameters: [] + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/AuthenticationList" + security: *ref_0 + /auth/v1/tokens/{id}: + get: + operationId: AuthService.getToken + tags: + - AuthService + parameters: + - name: id + in: path + required: true + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/Authentication" + security: *ref_0 + delete: + operationId: AuthService.deleteToken + tags: + - AuthService + parameters: + - name: id + in: path + required: true + schema: + type: string + responses: + "204": + description: "" + security: *ref_0 + /auth/v1/self: + get: + operationId: AuthService.getSelf + tags: + - AuthService + parameters: [] + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/Authentication" + security: *ref_0 + /auth/v1/self/expire: + put: + operationId: AuthService.expireSelf + tags: + - AuthService + parameters: [] + responses: + "204": + description: "" + security: *ref_0 + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + expiresAt: + type: string + format: date-time + /api/v1/namespaces/{namespaceKey}/segments/{segmentKey}/constraints: + post: + operationId: ConstraintsService.create + tags: + - ConstraintsService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: segmentKey + in: path + required: true + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/Constraint" + security: *ref_0 + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ConstraintCreateRequest" + /api/v1/namespaces/{namespaceKey}/segments/{segmentKey}/constraints/{id}: + delete: + operationId: ConstraintsService.delete + tags: + - ConstraintsService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: segmentKey + in: path + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + responses: + "204": + description: "" + security: *ref_0 + put: + operationId: ConstraintsService.update + tags: + - ConstraintsService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: segmentKey + in: path + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + responses: + "204": + description: "" + security: *ref_0 + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ConstraintUpdateRequest" + /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{ruleId}/distributions: + post: + operationId: DistributionsService.create + tags: + - DistributionsService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + - name: ruleId + in: path + required: true + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/Distribution" + security: *ref_0 + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/DistributionCreateRequest" + /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{ruleId}/distributions/{id}: + delete: + operationId: DistributionsService.delete + tags: + - DistributionsService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + - name: ruleId + in: path + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + - name: variantId + in: query + required: true + schema: + type: string + responses: + "204": + description: "" + security: *ref_0 + put: + operationId: DistributionsService.update + tags: + - DistributionsService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + - name: ruleId + in: path + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/Distribution" + security: *ref_0 + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/DistributionUpdateRequest" + /api/v1/namespaces/{namespaceKey}/evaluate: + post: + operationId: EvaluateService.evaluate + tags: + - EvaluateService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/EvaluationResponse" + security: *ref_0 + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/EvaluationRequest" + /api/v1/namespaces/{namespaceKey}/batch-evaluate: + post: + operationId: EvaluateService.batchEvaluate + tags: + - EvaluateService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/BatchEvaluationResponse" + security: *ref_0 + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/BatchEvaluationRequest" + /api/v1/namespaces/{namespaceKey}/flags: + get: + operationId: FlagsService.list + tags: + - FlagsService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: limit + in: query + required: false + schema: + type: integer + - name: offset + in: query + required: false + schema: + type: integer + - name: pageToken + in: query + required: false + schema: + type: string + - name: reference + in: query + required: false + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/FlagList" + security: *ref_0 + post: + operationId: FlagsService.create + tags: + - FlagsService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/Flag" + security: *ref_0 + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/FlagCreateRequest" + /api/v1/namespaces/{namespaceKey}/flags/{key}: + get: + operationId: FlagsService.get + tags: + - FlagsService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: key + in: path + required: true + schema: + type: string + - name: reference + in: query + required: false + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/Flag" + security: *ref_0 + delete: + operationId: FlagsService.delete + tags: + - FlagsService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: key + in: path + required: true + schema: + type: string + responses: + "204": + description: "" + security: *ref_0 + put: + operationId: FlagsService.update + tags: + - FlagsService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: key + in: path + required: true + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/Flag" + security: *ref_0 + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/FlagUpdateRequest" + /api/v1/namespaces: + get: + operationId: NamespacesService.list + tags: + - NamespacesService + parameters: + - name: limit + in: query + required: false + schema: + type: integer + - name: offset + in: query + required: false + schema: + type: integer + - name: pageToken + in: query + required: false + schema: + type: string + - name: reference + in: query + required: false + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/NamespaceList" + security: *ref_0 + post: + operationId: NamespacesService.create + tags: + - NamespacesService + parameters: [] + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/Namespace" + security: *ref_0 + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/NamespaceCreateRequest" + /api/v1/namespaces/{key}: + get: + operationId: NamespacesService.get + tags: + - NamespacesService + parameters: + - name: key + in: path + required: true + schema: + type: string + - name: reference + in: query + required: false + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/Namespace" + security: *ref_0 + delete: + operationId: NamespacesService.delete + tags: + - NamespacesService + parameters: + - name: key + in: path + required: true + schema: + type: string + responses: + "204": + description: "" + security: *ref_0 + put: + operationId: NamespacesService.update + tags: + - NamespacesService + parameters: + - name: key + in: path + required: true + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/Namespace" + security: *ref_0 + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/NamespaceUpdateRequest" + /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts: + get: + operationId: RolloutsService.list + tags: + - RolloutsService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + - name: limit + in: query + required: false + schema: + type: integer + - name: offset + in: query + required: false + schema: + type: integer + - name: pageToken + in: query + required: false + schema: + type: string + - name: reference + in: query + required: false + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/RolloutList" + security: *ref_0 + post: + operationId: RolloutsService.create + tags: + - RolloutsService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/Rollout" + security: *ref_0 + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/RolloutCreateRequest" + /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts/order: + put: + operationId: RolloutsService.order + tags: + - RolloutsService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + responses: + "204": + description: "" + security: *ref_0 + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/RolloutOrderRequest" + /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts/{id}: + get: + operationId: RolloutsService.get + tags: + - RolloutsService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + - name: reference + in: query + required: false + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/Rollout" + security: *ref_0 + delete: + operationId: RolloutsService.delete + tags: + - RolloutsService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + responses: + "204": + description: "" + security: *ref_0 + put: + operationId: RolloutsService.update + tags: + - RolloutsService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + responses: + "204": + description: "" + security: *ref_0 + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/RolloutUpdateRequest" + /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules: + get: + operationId: RulesService.list + tags: + - RulesService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + - name: limit + in: query + required: false + schema: + type: integer + - name: offset + in: query + required: false + schema: + type: integer + - name: pageToken + in: query + required: false + schema: + type: string + - name: reference + in: query + required: false + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/RuleList" + security: *ref_0 + post: + operationId: RulesService.create + tags: + - RulesService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/Rule" + security: *ref_0 + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/RuleCreateRequest" + /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/order: + put: + operationId: RulesService.order + tags: + - RulesService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + responses: + "204": + description: "" + security: *ref_0 + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/RuleOrderRequest" + /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{id}: + get: + operationId: RulesService.get + tags: + - RulesService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + - name: reference + in: query + required: false + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/Rule" + security: *ref_0 + delete: + operationId: RulesService.delete + tags: + - RulesService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + responses: + "204": + description: "" + security: *ref_0 + put: + operationId: RulesService.update + tags: + - RulesService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + responses: + "204": + description: "" + security: *ref_0 + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/RuleUpdateRequest" + /api/v1/namespaces/{namespaceKey}/segments: + get: + operationId: SegmentsService.list + tags: + - SegmentsService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: limit + in: query + required: false + schema: + type: integer + - name: offset + in: query + required: false + schema: + type: integer + - name: pageToken + in: query + required: false + schema: + type: string + - name: reference + in: query + required: false + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/SegmentList" + security: *ref_0 + post: + operationId: SegmentsService.create + tags: + - SegmentsService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/Segment" + security: *ref_0 + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/SegmentCreateRequest" + /api/v1/namespaces/{namespaceKey}/segments/{key}: + get: + operationId: SegmentsService.get + tags: + - SegmentsService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: key + in: path + required: true + schema: + type: string + - name: reference + in: query + required: false + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/Segment" + security: *ref_0 + delete: + operationId: SegmentsService.delete + tags: + - SegmentsService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: key + in: path + required: true + schema: + type: string + responses: + "204": + description: "" + security: *ref_0 + put: + operationId: SegmentsService.update + tags: + - SegmentsService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: key + in: path + required: true + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/Segment" + security: *ref_0 + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/SegmentUpdateRequest" + /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/variants: + post: + operationId: VariantsService.create + tags: + - VariantsService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/Variant" + security: *ref_0 + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/VariantCreateRequest" + /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/variants/{id}: + delete: + operationId: VariantsService.delete + tags: + - VariantsService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + responses: + "204": + description: "" + security: *ref_0 + put: + operationId: VariantsService.update + tags: + - VariantsService + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + $ref: "#/components/schemas/Variant" + security: *ref_0 + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/VariantUpdateRequest" +components: + schemas: + EvaluationRequest: + type: object + properties: + requestId: + type: string + namespaceKey: + type: string + flagKey: + type: string + entityId: + type: string + context: + type: object + additionalProperties: + type: string + reference: + type: string + required: + - namespaceKey + - flagKey + - entityId + - context + EvaluationResponseType: + type: string + enum: + - VARIANT_EVALUATION_RESPONSE_TYPE + - BOOLEAN_EVALUATION_RESPONSE_TYPE + - ERROR_EVALUATION_RESPONSE_TYPE + EvaluationResponse: + type: object + properties: + type: + $ref: "#/components/schemas/EvaluationResponseType" + booleanResponse: + $ref: "#/components/schemas/BooleanEvaluationResponse" + variantResponse: + $ref: "#/components/schemas/VariantEvaluationResponse" + errorResponse: + $ref: "#/components/schemas/ErrorEvaluationResponse" + required: + - type + ErrorEvaluationResponse: + type: object + properties: + flagKey: + type: string + namespaceKey: + type: string + reason: + $ref: "#/components/schemas/ErrorEvaluationReason" + required: + - flagKey + - namespaceKey + - reason + BooleanEvaluationResponse: + type: object + properties: + requestId: + type: string + flagKey: + type: string + enabled: + type: boolean + timestamp: + type: string + format: date-time + requestDurationMillis: + type: number + format: double + reason: + $ref: "#/components/schemas/EvaluationReason" + required: + - requestId + - flagKey + - enabled + - timestamp + - requestDurationMillis + - reason + VariantEvaluationResponse: + type: object + properties: + requestId: + type: string + match: + type: boolean + flagKey: + type: string + segmentKeys: + type: array + items: + type: string + variantKey: + type: string + variantAttachment: + type: string + timestamp: + type: string + format: date-time + requestDurationMillis: + type: number + format: double + reason: + $ref: "#/components/schemas/EvaluationReason" + required: + - requestId + - match + - flagKey + - segmentKeys + - variantKey + - variantAttachment + - timestamp + - requestDurationMillis + - reason + EvaluationReason: + type: string + enum: + - UNKNOWN_EVALUATION_REASON + - FLAG_DISABLED_EVALUATION_REASON + - MATCH_EVALUATION_REASON + - DEFAULT_EVALUATION_REASON + ErrorEvaluationReason: + type: string + enum: + - UNKNOWN_ERROR_EVALUATION_REASON + - NOT_FOUND_ERROR_EVALUATION_REASON + BatchEvaluationRequest: + type: object + properties: + requestId: + type: string + requests: + type: array + items: + $ref: "#/components/schemas/EvaluationRequest" + reference: + type: string + required: + - requests + BatchEvaluationResponse: + type: object + properties: + requestId: + type: string + responses: + type: array + items: + $ref: "#/components/schemas/EvaluationResponse" + requestDurationMillis: + type: number + format: double + required: + - requestId + - responses + - requestDurationMillis + AuthMethodOIDCAuthorizeURLResponse: + type: object + properties: + authorizeUrl: + type: string + required: + - authorizeUrl + AuthMethodOIDCCallbackResponse: + type: object + properties: + authentication: + $ref: "#/components/schemas/Authentication" + required: + - authentication + AuthenticationMethod: + type: string + enum: + - METHOD_NONE + - METHOD_TOKEN + - METHOD_OIDC + - METHOD_KUBERNETES + - METHOD_JWT + description: The default is METHOD_NONE + Authentication: + type: object + properties: + id: + type: string + method: + $ref: "#/components/schemas/AuthenticationMethod" + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + expiresAt: + type: string + format: date-time + metadata: + type: object + additionalProperties: + type: string + required: + - id + - method + - createdAt + - updatedAt + - metadata + AuthenticationList: + type: object + properties: + authentications: + type: array + items: + $ref: "#/components/schemas/Authentication" + nextPageToken: + type: string + required: + - authentications + - nextPageToken + AuthenticationToken: + type: object + properties: + clientToken: + type: string + authentication: + $ref: "#/components/schemas/Authentication" + required: + - clientToken + - authentication + CommonsPageable: + type: object + properties: + nextPageToken: + type: string + totalCount: + type: integer + ConstraintComparisonType: + type: string + enum: + - UNKNOWN_COMPARISON_TYPE + - STRING_COMPARISON_TYPE + - NUMBER_COMPARISON_TYPE + - BOOLEAN_COMPARISON_TYPE + - DATETIME_COMPARISON_TYPE + description: The default is UNKNOWN_COMPARISON_TYPE + Constraint: + type: object + properties: + id: + type: string + namespaceKey: + type: string + segmentKey: + type: string + type: + $ref: "#/components/schemas/ConstraintComparisonType" + property: + type: string + operator: + type: string + value: + type: string + description: + type: string + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + required: + - id + - namespaceKey + - segmentKey + - type + - property + - operator + - value + - description + - createdAt + - updatedAt + ConstraintCreateRequest: + type: object + properties: + type: + $ref: "#/components/schemas/ConstraintComparisonType" + property: + type: string + operator: + type: string + value: + type: string + description: + type: string + required: + - type + - property + - operator + ConstraintUpdateRequest: + type: object + properties: + type: + $ref: "#/components/schemas/ConstraintComparisonType" + property: + type: string + operator: + type: string + value: + type: string + description: + type: string + required: + - type + - property + - operator + Distribution: + type: object + properties: + id: + type: string + ruleId: + type: string + variantId: + type: string + rollout: + type: number + format: double + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + required: + - id + - ruleId + - variantId + - rollout + - createdAt + - updatedAt + DistributionCreateRequest: + type: object + properties: + variantId: + type: string + rollout: + type: number + format: double + required: + - variantId + - rollout + DistributionUpdateRequest: + type: object + properties: + variantId: + type: string + rollout: + type: number + format: double + required: + - variantId + - rollout + FlagList: + type: object + properties: + flags: + type: array + items: + $ref: "#/components/schemas/Flag" + nextPageToken: + type: string + totalCount: + type: integer + required: + - flags + - nextPageToken + - totalCount + Flag: + type: object + properties: + namespaceKey: + type: string + key: + type: string + name: + type: string + description: + type: string + enabled: + type: boolean + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + variants: + type: array + items: + $ref: "#/components/schemas/Variant" + type: + $ref: "#/components/schemas/FlagType" + defaultVariant: + $ref: "#/components/schemas/Variant" + required: + - namespaceKey + - key + - name + - description + - enabled + - createdAt + - updatedAt + - variants + - type + FlagType: + type: string + enum: + - VARIANT_FLAG_TYPE + - BOOLEAN_FLAG_TYPE + FlagCreateRequest: + type: object + properties: + key: + type: string + name: + type: string + description: + type: string + enabled: + type: boolean + type: + $ref: "#/components/schemas/FlagType" + required: + - key + - name + - type + FlagUpdateRequest: + type: object + properties: + name: + type: string + description: + type: string + enabled: + type: boolean + defaultVariantId: + type: string + required: + - name + NamespaceList: + type: object + properties: + namespaces: + type: array + items: + $ref: "#/components/schemas/Namespace" + nextPageToken: + type: string + totalCount: + type: integer + required: + - namespaces + - nextPageToken + - totalCount + Namespace: + type: object + properties: + key: + type: string + name: + type: string + description: + type: string + protected: + type: boolean + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + required: + - key + - name + - description + - protected + - createdAt + - updatedAt + NamespaceCreateRequest: + type: object + properties: + key: + type: string + name: + type: string + description: + type: string + required: + - key + - name + NamespaceUpdateRequest: + type: object + properties: + name: + type: string + description: + type: string + required: + - name + RolloutList: + type: object + properties: + rollouts: + type: array + items: + $ref: "#/components/schemas/Rollout" + nextPageToken: + type: string + totalCount: + type: integer + required: + - rollouts + - nextPageToken + - totalCount + Rollout: + type: object + properties: + id: + type: string + namespaceKey: + type: string + flagKey: + type: string + type: + $ref: "#/components/schemas/RolloutType" + rank: + type: integer + description: + type: string + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + segment: + $ref: "#/components/schemas/RolloutSegment" + threshold: + $ref: "#/components/schemas/RolloutThreshold" + required: + - id + - namespaceKey + - flagKey + - type + - rank + - description + - createdAt + - updatedAt + RolloutSegmentOperator: + type: string + enum: + - OR_SEGMENT_OPERATOR + - AND_SEGMENT_OPERATOR + RolloutType: + type: string + enum: + - UNKNOWN_ROLLOUT_TYPE + - SEGMENT_ROLLOUT_TYPE + - THRESHOLD_ROLLOUT_TYPE + RolloutSegment: + type: object + properties: + segmentKey: + type: string + segmentKeys: + type: array + items: + type: string + segmentOperator: + $ref: "#/components/schemas/RolloutSegmentOperator" + value: + type: boolean + required: + - segmentKey + - value + RolloutThreshold: + type: object + properties: + percentage: + type: number + format: double + value: + type: boolean + required: + - percentage + - value + RolloutCreateRequest: + type: object + properties: + rank: + type: integer + description: + type: string + segment: + $ref: "#/components/schemas/RolloutSegment" + threshold: + $ref: "#/components/schemas/RolloutThreshold" + required: + - rank + RolloutUpdateRequest: + type: object + properties: + description: + type: string + segment: + $ref: "#/components/schemas/RolloutSegment" + threshold: + $ref: "#/components/schemas/RolloutThreshold" + RolloutOrderRequest: + type: object + properties: + rolloutIds: + type: array + items: + type: string + required: + - rolloutIds + RuleList: + type: object + properties: + rules: + type: array + items: + $ref: "#/components/schemas/Rule" + nextPageToken: + type: string + totalCount: + type: integer + required: + - rules + - nextPageToken + - totalCount + RuleSegmentOperator: + type: string + enum: + - OR_SEGMENT_OPERATOR + - AND_SEGMENT_OPERATOR + Rule: + type: object + properties: + id: + type: string + namespaceKey: + type: string + flagKey: + type: string + segmentKey: + type: string + segmentKeys: + type: array + items: + type: string + segmentOperator: + $ref: "#/components/schemas/RuleSegmentOperator" + distributions: + type: array + items: + $ref: "#/components/schemas/Distribution" + rank: + type: integer + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + required: + - id + - namespaceKey + - flagKey + - segmentKey + - segmentOperator + - distributions + - rank + - createdAt + - updatedAt + RuleCreateRequest: + type: object + properties: + segmentKey: + type: string + segmentKeys: + type: array + items: + type: string + segmentOperator: + $ref: "#/components/schemas/RuleSegmentOperator" + rank: + type: integer + required: + - segmentKey + - rank + RuleOrderRequest: + type: object + properties: + ruleIds: + type: array + items: + type: string + required: + - ruleIds + RuleUpdateRequest: + type: object + properties: + segmentKey: + type: string + segmentKeys: + type: array + items: + type: string + segmentOperator: + $ref: "#/components/schemas/RuleSegmentOperator" + required: + - segmentKey + SegmentList: + type: object + properties: + segments: + type: array + items: + $ref: "#/components/schemas/Segment" + nextPageToken: + type: string + totalCount: + type: integer + required: + - segments + - nextPageToken + - totalCount + Segment: + type: object + properties: + namespaceKey: + type: string + key: + type: string + name: + type: string + description: + type: string + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + constraints: + type: array + items: + $ref: "#/components/schemas/Constraint" + matchType: + $ref: "#/components/schemas/SegmentMatchType" + required: + - namespaceKey + - key + - name + - description + - createdAt + - updatedAt + - constraints + - matchType + SegmentMatchType: + type: string + enum: + - ALL_MATCH_TYPE + - ANY_MATCH_TYPE + SegmentCreateRequest: + type: object + properties: + key: + type: string + name: + type: string + description: + type: string + matchType: + $ref: "#/components/schemas/SegmentMatchType" + required: + - key + - name + - description + - matchType + SegmentUpdateRequest: + type: object + properties: + name: + type: string + description: + type: string + matchType: + $ref: "#/components/schemas/SegmentMatchType" + required: + - name + - description + - matchType + Variant: + type: object + properties: + id: + type: string + namespaceKey: + type: string + flagKey: + type: string + key: + type: string + name: + type: string + description: + type: string + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + attachment: + type: string + required: + - id + - namespaceKey + - flagKey + - key + - name + - description + - createdAt + - updatedAt + - attachment + VariantCreateRequest: + type: object + properties: + key: + type: string + name: + type: string + description: + type: string + attachment: + type: string + required: + - key + VariantUpdateRequest: + type: object + properties: + key: + type: string + name: + type: string + description: + type: string + attachment: + type: string + required: + - key + securitySchemes: + BearerAuth: + type: http + scheme: bearer +servers: + - url: http://localhost:8080 diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs index fa39cfd8..1a80e999 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs @@ -1,9 +1,9 @@ -using Flipt.DTOs; +using Flipt.Rest; using FluentAssertions; using Moq; using OpenFeature.Constant; +using OpenFeature.Contrib.Providers.Flipt.ClientWrapper; using OpenFeature.Model; -using Reason = Flipt.Models.Reason; namespace OpenFeature.Contrib.Providers.Flipt.Test; @@ -23,8 +23,7 @@ public void CreateFliptProvider_ShouldReturnFliptProvider() public void CreateFliptProvider_GivenEmptyUrl_ShouldThrowInvalidOperationException() { var act = void () => new FliptProvider(""); - act.Should().Throw() - .WithMessage("BaseURL must be provided."); + act.Should().Throw(); } @@ -44,7 +43,7 @@ public async Task SegmentKeys = ["segment1"], VariantAttachment = "", Match = true, - Reason = Reason.MatchEvaluationReason + Reason = EvaluationReason.MATCH_EVALUATION_REASON }); var provider = new FliptProvider(new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object)); diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs index 7e63ab08..db7f2d60 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs @@ -1,10 +1,10 @@ using System.Net; -using Flipt.DTOs; +using Flipt.Rest; using FluentAssertions; using Moq; using OpenFeature.Constant; +using OpenFeature.Contrib.Providers.Flipt.ClientWrapper; using OpenFeature.Model; -using Reason = Flipt.Models.Reason; namespace OpenFeature.Contrib.Providers.Flipt.Test; @@ -110,7 +110,7 @@ public async Task EvaluateAsync_GivenExistingVariantFlagWhichIsNotAnObject_Shoul SegmentKeys = ["segment1"], VariantAttachment = variantAttachment, Match = true, - Reason = Reason.MatchEvaluationReason + Reason = EvaluationReason.MATCH_EVALUATION_REASON }); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); @@ -147,7 +147,7 @@ public async Task EvaluateAsync_GivenExistingVariantFlagAndWithAnObject_ShouldRe SegmentKeys = ["segment1"], VariantAttachment = valueFromSrc, Match = true, - Reason = Reason.MatchEvaluationReason + Reason = EvaluationReason.MATCH_EVALUATION_REASON }); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); From 563dd5f1b3cdca682a109f4179ac1495b34b8c51 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Wed, 2 Oct 2024 23:54:10 +0200 Subject: [PATCH 18/47] Changed exception handling to use generated exceptions by nswag Signed-off-by: Andrei de la Cruz --- .../FliptToOpenFeatureConverter.cs | 22 +++++++++++++++---- ...OpenFeature.Contrib.Providers.Flipt.csproj | 6 +++-- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs index fd1ca010..449067a1 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs @@ -78,9 +78,9 @@ public async Task> EvaluateAsync(string flagKey, T defau return new ResolutionDetails(flagKey, defaultValue, ErrorType.TypeMismatch); } } - catch (HttpRequestException ex) + catch (FliptException ex) { - return ResolutionDetailFromHttpException(ex, flagKey, defaultValue); + return ResolutionDetailFromFliptException(ex, flagKey, defaultValue); } return new ResolutionDetails(flagKey, defaultValue, ErrorType.General); @@ -103,9 +103,9 @@ public async Task> EvaluateBooleanAsync(string flagKey, return new ResolutionDetails(flagKey, boolEvaluationResponse.Enabled, ErrorType.None, boolEvaluationResponse.Reason.ToString()); } - catch (HttpRequestException ex) + catch (FliptException ex) { - return ResolutionDetailFromHttpException(ex, flagKey, defaultValue); + return ResolutionDetailFromFliptException(ex, flagKey, defaultValue); } } @@ -122,6 +122,20 @@ private static ResolutionDetails ResolutionDetailFromHttpException(HttpReq }; return new ResolutionDetails(flagKey, defaultValue, error, errorMessage: e.Message); } + + private static ResolutionDetails ResolutionDetailFromFliptException(FliptException e, string flagKey, + T defaultValue) + { + var error = (HttpStatusCode)e.StatusCode switch + { + HttpStatusCode.NotFound => ErrorType.FlagNotFound, + HttpStatusCode.BadRequest => ErrorType.TypeMismatch, + HttpStatusCode.Forbidden => ErrorType.ProviderNotReady, + HttpStatusCode.InternalServerError => ErrorType.ProviderNotReady, + _ => ErrorType.General + }; + return new ResolutionDetails(flagKey, defaultValue, error, errorMessage: e.Message); + } } /// diff --git a/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj b/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj index 4f3f22f4..6a48e18f 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj +++ b/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj @@ -1,8 +1,6 @@  - net8.0 - latest OpenFeature.Contrib.Providers.Flipt 0.1.0 $(VersionNumber) @@ -16,4 +14,8 @@ + + net8.0 + latest + From 29077ea2fb7f0161b8756a52705a12795a18a0f9 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Wed, 2 Oct 2024 23:54:56 +0200 Subject: [PATCH 19/47] Modified unit test to throw mocked FliptExceptions Signed-off-by: Andrei de la Cruz --- .../FliptToOpenFeatureConverterTest.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs index db7f2d60..f9e22903 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs @@ -23,7 +23,7 @@ public async Task EvaluateBooleanAsync_GivenHttpRequestException_ShouldHandleHtt var mockFliptClientWrapper = new Mock(); mockFliptClientWrapper.Setup(fcw => fcw.EvaluateBooleanAsync(It.IsAny())) - .ThrowsAsync(new HttpRequestException("", null, thrownStatusCode)); + .ThrowsAsync(new FliptException("", (int)thrownStatusCode, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); var resolution = await fliptToOpenFeature.EvaluateBooleanAsync("flagKey", fallbackValue); @@ -61,7 +61,7 @@ public async Task EvaluateBooleanAsync_GivenNonExistentFlag_ShouldReturnDefaultV { var mockFliptClientWrapper = new Mock(); mockFliptClientWrapper.Setup(fcw => fcw.EvaluateBooleanAsync(It.IsAny())) - .ThrowsAsync(new HttpRequestException("", null, HttpStatusCode.NotFound)); + .ThrowsAsync(new FliptException("", (int)HttpStatusCode.NotFound, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); var resolution = await fliptToOpenFeature.EvaluateBooleanAsync("show-feature", fallBackValue); @@ -85,7 +85,7 @@ public async Task EvaluateAsync_GivenHttpRequestException_ShouldHandleHttpReques var mockFliptClientWrapper = new Mock(); mockFliptClientWrapper.Setup(fcw => fcw.EvaluateVariantAsync(It.IsAny())) - .ThrowsAsync(new HttpRequestException("", null, thrownStatusCode)); + .ThrowsAsync(new FliptException("", (int)thrownStatusCode, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); var resolution = await fliptToOpenFeature.EvaluateAsync("flagKey", fallbackValue); @@ -169,7 +169,7 @@ public async Task })); var mockFliptClientWrapper = new Mock(); mockFliptClientWrapper.Setup(fcw => fcw.EvaluateVariantAsync(It.IsAny())) - .ThrowsAsync(new HttpRequestException("", null, HttpStatusCode.NotFound)); + .ThrowsAsync(new FliptException("", (int)HttpStatusCode.NotFound, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); var resolution = await fliptToOpenFeature.EvaluateAsync("non-existent-flag", fallbackValue); @@ -188,7 +188,7 @@ public async Task var fallbackValue = new Value(""); var mockFliptClientWrapper = new Mock(); mockFliptClientWrapper.Setup(fcw => fcw.EvaluateVariantAsync(It.IsAny())) - .ThrowsAsync(new HttpRequestException("", null, HttpStatusCode.NotFound)); + .ThrowsAsync(new FliptException("", (int)HttpStatusCode.NotFound, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); var resolution = await fliptToOpenFeature.EvaluateAsync("non-existent-flag", fallbackValue); From e11bdaae96f29781a0ace61da927f1db2582ccb1 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Thu, 3 Oct 2024 00:09:01 +0200 Subject: [PATCH 20/47] Utilized OpenFeature Reason type on Resolutions Signed-off-by: Andrei de la Cruz --- .../FliptToOpenFeatureConverter.cs | 16 ++++++++-------- .../FliptToOpenFeatureConverterTest.cs | 6 ++++++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs index 449067a1..494362ba 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs @@ -50,11 +50,11 @@ public async Task> EvaluateAsync(string flagKey, T defau if (evaluationResponse.Reason == EvaluationReason.FLAG_DISABLED_EVALUATION_REASON) return new ResolutionDetails(flagKey, defaultValue, ErrorType.None, - evaluationResponse.Reason.ToString()); + Reason.Disabled); if (!evaluationResponse.Match) return new ResolutionDetails(flagKey, defaultValue, ErrorType.None, - evaluationResponse.Reason.ToString()); + Reason.Default); try { if (string.IsNullOrEmpty(evaluationResponse.VariantAttachment)) @@ -62,7 +62,7 @@ public async Task> EvaluateAsync(string flagKey, T defau var convertedValue = (T)Convert.ChangeType(evaluationResponse.VariantKey, typeof(T)); return new ResolutionDetails(flagKey, convertedValue, ErrorType.None, - evaluationResponse.Reason.ToString(), evaluationResponse.VariantKey); + Reason.TargetingMatch, evaluationResponse.VariantKey); } var deserializedValueObj = JsonSerializer.Deserialize(evaluationResponse.VariantAttachment, @@ -70,12 +70,12 @@ public async Task> EvaluateAsync(string flagKey, T defau return new ResolutionDetails(flagKey, (T)Convert.ChangeType(deserializedValueObj, typeof(T)), - ErrorType.None, evaluationResponse.Reason.ToString(), evaluationResponse.VariantKey); + ErrorType.None, Reason.TargetingMatch, evaluationResponse.VariantKey); } catch (Exception ex) { if (ex is InvalidCastException or FormatException) - return new ResolutionDetails(flagKey, defaultValue, ErrorType.TypeMismatch); + return new ResolutionDetails(flagKey, defaultValue, ErrorType.TypeMismatch, Reason.Error); } } catch (FliptException ex) @@ -83,7 +83,7 @@ public async Task> EvaluateAsync(string flagKey, T defau return ResolutionDetailFromFliptException(ex, flagKey, defaultValue); } - return new ResolutionDetails(flagKey, defaultValue, ErrorType.General); + return new ResolutionDetails(flagKey, defaultValue, ErrorType.General, Reason.Unknown); } /// @@ -101,7 +101,7 @@ public async Task> EvaluateBooleanAsync(string flagKey, }; var boolEvaluationResponse = await fliptClientWrapper.EvaluateBooleanAsync(evaluationRequest); return new ResolutionDetails(flagKey, boolEvaluationResponse.Enabled, ErrorType.None, - boolEvaluationResponse.Reason.ToString()); + Reason.TargetingMatch); } catch (FliptException ex) { @@ -134,7 +134,7 @@ private static ResolutionDetails ResolutionDetailFromFliptException(FliptE HttpStatusCode.InternalServerError => ErrorType.ProviderNotReady, _ => ErrorType.General }; - return new ResolutionDetails(flagKey, defaultValue, error, errorMessage: e.Message); + return new ResolutionDetails(flagKey, defaultValue, error, errorMessage: e.Message, reason: Reason.Error); } } diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs index f9e22903..f3f7e7e8 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs @@ -29,6 +29,7 @@ public async Task EvaluateBooleanAsync_GivenHttpRequestException_ShouldHandleHtt var resolution = await fliptToOpenFeature.EvaluateBooleanAsync("flagKey", fallbackValue); resolution.Value.Should().Be(fallbackValue); resolution.ErrorType.Should().Be(expectedOpenFeatureErrorType); + resolution.Reason.Should().Be(Reason.Error); } [Theory] @@ -51,6 +52,8 @@ public async Task EvaluateBooleanAsync_GivenExistingFlag_ShouldReturnFlagValue(s resolution.FlagKey.Should().Be(flagKey); resolution.Value.Should().Be(valueFromSrc); + resolution.Reason.Should().Be(Reason.TargetingMatch); + } [Theory] @@ -69,6 +72,7 @@ public async Task EvaluateBooleanAsync_GivenNonExistentFlag_ShouldReturnDefaultV resolution.FlagKey.Should().Be(flagKey); resolution.Value.Should().Be(fallBackValue); resolution.ErrorType.Should().Be(ErrorType.FlagNotFound); + resolution.Reason.Should().Be(Reason.Error); } // EvaluateAsync Tests @@ -91,6 +95,7 @@ public async Task EvaluateAsync_GivenHttpRequestException_ShouldHandleHttpReques var resolution = await fliptToOpenFeature.EvaluateAsync("flagKey", fallbackValue); resolution.Value.Should().Be(fallbackValue); resolution.ErrorType.Should().Be(expectedOpenFeatureErrorType); + resolution.Reason.Should().Be(Reason.Error); } [Theory] @@ -119,6 +124,7 @@ public async Task EvaluateAsync_GivenExistingVariantFlagWhichIsNotAnObject_Shoul resolution.FlagKey.Should().Be(flagKey); resolution.Variant.Should().Be(valueFromSrc.ToString() ?? string.Empty); resolution.Value.Should().BeEquivalentTo(expectedValue?.ToString()); + resolution.Reason.Should().Be(Reason.TargetingMatch); } [Fact] From cd1b5a9c134eeb28625461074e5aa48a8c17b9da Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Thu, 3 Oct 2024 13:09:23 +0200 Subject: [PATCH 21/47] Change test project setting; Cleaned FLiptConverter code Signed-off-by: Andrei de la Cruz --- .../FliptToOpenFeatureConverter.cs | 29 +++++-------------- .../FlipExtensionsTest.cs | 1 + .../FliptProviderTest.cs | 3 ++ .../FliptToOpenFeatureConverterTest.cs | 2 +- ...eature.Contrib.Providers.Flipt.Test.csproj | 8 ----- 5 files changed, 12 insertions(+), 31 deletions(-) diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs index 494362ba..6ecf8a03 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs @@ -1,6 +1,5 @@ using System; using System.Net; -using System.Net.Http; using System.Text.Json; using System.Threading.Tasks; using Flipt.Rest; @@ -109,20 +108,6 @@ public async Task> EvaluateBooleanAsync(string flagKey, } } - private static ResolutionDetails ResolutionDetailFromHttpException(HttpRequestException e, string flagKey, - T defaultValue) - { - var error = e.StatusCode switch - { - HttpStatusCode.NotFound => ErrorType.FlagNotFound, - HttpStatusCode.BadRequest => ErrorType.TypeMismatch, - HttpStatusCode.Forbidden => ErrorType.ProviderNotReady, - HttpStatusCode.InternalServerError => ErrorType.ProviderNotReady, - _ => ErrorType.General - }; - return new ResolutionDetails(flagKey, defaultValue, error, errorMessage: e.Message); - } - private static ResolutionDetails ResolutionDetailFromFliptException(FliptException e, string flagKey, T defaultValue) { @@ -146,19 +131,19 @@ public interface IFliptToOpenFeatureConverter /// /// Used for evaluating non-boolean flags. Flipt handles datatypes which is not boolean as variants /// - /// - /// - /// - /// + /// Key of the flag to evaluate + /// Fallback value in case of error, or flag not present or disabled, or no match + /// Additional data to use to filter and segment requests + /// Type to evaluate. For boolean use EvaluateBoolean /// OpenFeature ResolutionDetails object Task> EvaluateAsync(string flagKey, T defaultValue, EvaluationContext context = null); /// /// Used for evaluating boolean flags /// - /// - /// - /// + /// Key of the flag to evaluate + /// Fallback value in case of error, or flag not present, or no match + /// Additional data to use to filter and segment requests /// OpenFeature ResolutionDetails object Task> EvaluateBooleanAsync(string flagKey, bool defaultValue, EvaluationContext context = null); diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs index e38320e9..5ef601ba 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs @@ -2,6 +2,7 @@ using FluentAssertions; using OpenFeature.Contrib.Providers.Flipt.Converters; using OpenFeature.Model; +using Xunit; namespace OpenFeature.Contrib.Providers.Flipt.Test; diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs index 1a80e999..2c809bc7 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs @@ -4,6 +4,7 @@ using OpenFeature.Constant; using OpenFeature.Contrib.Providers.Flipt.ClientWrapper; using OpenFeature.Model; +using Xunit; namespace OpenFeature.Contrib.Providers.Flipt.Test; @@ -63,4 +64,6 @@ public async Task valueResolution.Value.Should().BeEquivalentTo(new Value()); valueResolution.ErrorType.Should().Be(ErrorType.TypeMismatch); } + + // Todo Andrei: Add tests to make sure that the wrapper was called } \ No newline at end of file diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs index f3f7e7e8..3a0a2de3 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs @@ -5,6 +5,7 @@ using OpenFeature.Constant; using OpenFeature.Contrib.Providers.Flipt.ClientWrapper; using OpenFeature.Model; +using Xunit; namespace OpenFeature.Contrib.Providers.Flipt.Test; @@ -53,7 +54,6 @@ public async Task EvaluateBooleanAsync_GivenExistingFlag_ShouldReturnFlagValue(s resolution.FlagKey.Should().Be(flagKey); resolution.Value.Should().Be(valueFromSrc); resolution.Reason.Should().Be(Reason.TargetingMatch); - } [Theory] diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj b/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj index df3c0e7f..77a272fe 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj @@ -17,14 +17,6 @@ - - - - - - - - From 83d0fde87f46fb5738f046e50d2ba1f33ef3a169 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Thu, 3 Oct 2024 14:08:42 +0200 Subject: [PATCH 22/47] Change types to support all .net target versions Signed-off-by: Andrei de la Cruz --- nuget.config | 4 +- .../OpenFeatureStructureConverter.cs | 19 +- .../Converters/OpenFeatureValueConverter.cs | 9 +- .../Flipt.Rest.Client.cs | 382 +++++++++--------- .../FliptToOpenFeatureConverter.cs | 24 +- ...OpenFeature.Contrib.Providers.Flipt.csproj | 8 +- .../FliptToOpenFeatureConverterTest.cs | 10 +- ...eature.Contrib.Providers.Flipt.Test.csproj | 1 - 8 files changed, 231 insertions(+), 226 deletions(-) diff --git a/nuget.config b/nuget.config index 5a0edf43..06acf1e4 100644 --- a/nuget.config +++ b/nuget.config @@ -1,10 +1,10 @@ - + - + diff --git a/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureStructureConverter.cs b/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureStructureConverter.cs index f657fe92..96da85b2 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureStructureConverter.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureStructureConverter.cs @@ -12,22 +12,19 @@ namespace OpenFeature.Contrib.Providers.Flipt.Converters; public class OpenFeatureStructureConverter : JsonConverter { /// - public override Structure Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, Structure value, JsonSerializerOptions options) { - using var jsonDocument = JsonDocument.ParseValue(ref reader); - var jsonText = jsonDocument.RootElement.GetRawText(); - return new Structure(JsonSerializer.Deserialize>(jsonText, + var jsonDoc = JsonDocument.Parse(JsonSerializer.Serialize(value.AsDictionary(), JsonConverterExtensions.DefaultSerializerSettings)); + jsonDoc.WriteTo(writer); } /// - public override void Write(Utf8JsonWriter writer, Structure value, JsonSerializerOptions options) + public override Structure Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - var serializeOptions = new JsonSerializerOptions - { - WriteIndented = true, - Converters = { new OpenFeatureValueConverter() } - }; - writer.WriteRawValue(JsonSerializer.Serialize(value.AsDictionary(), serializeOptions)); + using var jsonDocument = JsonDocument.ParseValue(ref reader); + var jsonText = jsonDocument.RootElement.GetRawText(); + return new Structure(JsonSerializer.Deserialize>(jsonText, + JsonConverterExtensions.DefaultSerializerSettings)); } } \ No newline at end of file diff --git a/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureValueConverter.cs b/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureValueConverter.cs index ab413429..6c638dad 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureValueConverter.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/Converters/OpenFeatureValueConverter.cs @@ -84,14 +84,19 @@ public override void Write(Utf8JsonWriter writer, Value value, JsonSerializerOpt { writer.WriteStartArray(); foreach (var val in value.AsList!) - writer.WriteRawValue(JsonSerializer.Serialize(val.AsObject, + { + var jsonDoc = JsonDocument.Parse(JsonSerializer.Serialize(val.AsObject, JsonConverterExtensions.DefaultSerializerSettings)); + jsonDoc.WriteTo(writer); + } + writer.WriteEndArray(); } else { - writer.WriteRawValue(JsonSerializer.Serialize(value.AsObject, + var jsonDoc = JsonDocument.Parse(JsonSerializer.Serialize(value.AsObject, JsonConverterExtensions.DefaultSerializerSettings)); + jsonDoc.WriteTo(writer); } } } \ No newline at end of file diff --git a/src/OpenFeature.Contrib.Providers.Flipt/Flipt.Rest.Client.cs b/src/OpenFeature.Contrib.Providers.Flipt/Flipt.Rest.Client.cs index 83c2d331..f9606366 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/Flipt.Rest.Client.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/Flipt.Rest.Client.cs @@ -27,203 +27,203 @@ public partial interface IFliptRestClient { /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task EvaluateV1BooleanAsync(EvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task EvaluateV1VariantAsync(EvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task EvaluateV1BatchAsync(BatchEvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task AuthV1MethodKubernetesServiceaccountAsync(Body body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task AuthV1MethodOidcAuthorizeAsync(string provider, string state, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task AuthV1MethodOidcCallbackAsync(string provider, string code, string state, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task AuthV1MethodTokenAsync(Body2 body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task AuthV1TokensGetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task AuthV1TokensGetAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task AuthV1TokensDeleteAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task AuthV1SelfAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task AuthV1SelfExpireAsync(Body3 body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsPostAsync(string namespaceKey, string segmentKey, ConstraintCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsDeleteAsync(string namespaceKey, string segmentKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsPutAsync(string namespaceKey, string segmentKey, string id, ConstraintUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsPostAsync(string namespaceKey, string flagKey, string ruleId, DistributionCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsDeleteAsync(string namespaceKey, string flagKey, string ruleId, string id, string variantId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsPutAsync(string namespaceKey, string flagKey, string ruleId, string id, DistributionUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesEvaluateAsync(string namespaceKey, EvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesBatchEvaluateAsync(string namespaceKey, BatchEvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesFlagsGetAsync(string namespaceKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesFlagsPostAsync(string namespaceKey, FlagCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesFlagsGetAsync(string namespaceKey, string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesFlagsDeleteAsync(string namespaceKey, string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesFlagsPutAsync(string namespaceKey, string key, FlagUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesGetAsync(int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesPostAsync(NamespaceCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesGetAsync(string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesDeleteAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesPutAsync(string key, NamespaceUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsGetAsync(string namespaceKey, string flagKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsPostAsync(string namespaceKey, string flagKey, RolloutCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsOrderAsync(string namespaceKey, string flagKey, RolloutOrderRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsGetAsync(string namespaceKey, string flagKey, string id, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsPutAsync(string namespaceKey, string flagKey, string id, RolloutUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesGetAsync(string namespaceKey, string flagKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesPostAsync(string namespaceKey, string flagKey, RuleCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesOrderAsync(string namespaceKey, string flagKey, RuleOrderRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesGetAsync(string namespaceKey, string flagKey, string id, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesPutAsync(string namespaceKey, string flagKey, string id, RuleUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesSegmentsGetAsync(string namespaceKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesSegmentsPostAsync(string namespaceKey, SegmentCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesSegmentsGetAsync(string namespaceKey, string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesSegmentsDeleteAsync(string namespaceKey, string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesSegmentsPutAsync(string namespaceKey, string key, SegmentUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsPostAsync(string namespaceKey, string flagKey, VariantCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsPutAsync(string namespaceKey, string flagKey, string id, VariantUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } @@ -261,7 +261,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task EvaluateV1BooleanAsync(EvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (body == null) @@ -313,14 +313,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -338,7 +338,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task EvaluateV1VariantAsync(EvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (body == null) @@ -390,14 +390,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -415,7 +415,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task EvaluateV1BatchAsync(BatchEvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (body == null) @@ -467,14 +467,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -492,7 +492,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task AuthV1MethodKubernetesServiceaccountAsync(Body body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (body == null) @@ -544,14 +544,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -569,7 +569,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task AuthV1MethodOidcAuthorizeAsync(string provider, string state, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (provider == null) @@ -625,14 +625,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -650,7 +650,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task AuthV1MethodOidcCallbackAsync(string provider, string code, string state, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (provider == null) @@ -710,14 +710,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -735,7 +735,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task AuthV1MethodTokenAsync(Body2 body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (body == null) @@ -787,14 +787,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -812,7 +812,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task AuthV1TokensGetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { var client_ = _httpClient; @@ -857,14 +857,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -882,7 +882,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task AuthV1TokensGetAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (id == null) @@ -931,14 +931,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -956,7 +956,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task AuthV1TokensDeleteAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (id == null) @@ -1006,7 +1006,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -1024,7 +1024,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task AuthV1SelfAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { var client_ = _httpClient; @@ -1069,14 +1069,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -1094,7 +1094,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task AuthV1SelfExpireAsync(Body3 body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (body == null) @@ -1147,7 +1147,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -1165,7 +1165,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsPostAsync(string namespaceKey, string segmentKey, ConstraintCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -1227,14 +1227,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -1252,7 +1252,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsDeleteAsync(string namespaceKey, string segmentKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -1312,7 +1312,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -1330,7 +1330,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsPutAsync(string namespaceKey, string segmentKey, string id, ConstraintUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -1397,7 +1397,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -1415,7 +1415,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsPostAsync(string namespaceKey, string flagKey, string ruleId, DistributionCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -1482,14 +1482,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -1507,7 +1507,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsDeleteAsync(string namespaceKey, string flagKey, string ruleId, string id, string variantId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -1578,7 +1578,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -1596,7 +1596,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsPutAsync(string namespaceKey, string flagKey, string ruleId, string id, DistributionUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -1667,14 +1667,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -1692,7 +1692,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesEvaluateAsync(string namespaceKey, EvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -1749,14 +1749,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -1774,7 +1774,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesBatchEvaluateAsync(string namespaceKey, BatchEvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -1831,14 +1831,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -1856,7 +1856,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsGetAsync(string namespaceKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -1924,14 +1924,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -1949,7 +1949,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsPostAsync(string namespaceKey, FlagCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -2006,14 +2006,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -2031,7 +2031,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsGetAsync(string namespaceKey, string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -2091,14 +2091,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -2116,7 +2116,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsDeleteAsync(string namespaceKey, string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -2171,7 +2171,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -2189,7 +2189,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsPutAsync(string namespaceKey, string key, FlagUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -2250,14 +2250,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -2275,7 +2275,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesGetAsync(int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { var client_ = _httpClient; @@ -2338,14 +2338,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -2363,7 +2363,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesPostAsync(NamespaceCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (body == null) @@ -2415,14 +2415,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -2440,7 +2440,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesGetAsync(string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (key == null) @@ -2495,14 +2495,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -2520,7 +2520,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesDeleteAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (key == null) @@ -2570,7 +2570,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -2588,7 +2588,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesPutAsync(string key, NamespaceUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (key == null) @@ -2644,14 +2644,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -2669,7 +2669,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsGetAsync(string namespaceKey, string flagKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -2742,14 +2742,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -2767,7 +2767,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsPostAsync(string namespaceKey, string flagKey, RolloutCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -2829,14 +2829,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -2854,7 +2854,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsOrderAsync(string namespaceKey, string flagKey, RolloutOrderRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -2917,7 +2917,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -2935,7 +2935,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsGetAsync(string namespaceKey, string flagKey, string id, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -3000,14 +3000,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -3025,7 +3025,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -3085,7 +3085,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -3103,7 +3103,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsPutAsync(string namespaceKey, string flagKey, string id, RolloutUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -3170,7 +3170,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -3188,7 +3188,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesGetAsync(string namespaceKey, string flagKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -3261,14 +3261,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -3286,7 +3286,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesPostAsync(string namespaceKey, string flagKey, RuleCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -3348,14 +3348,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -3373,7 +3373,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesOrderAsync(string namespaceKey, string flagKey, RuleOrderRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -3436,7 +3436,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -3454,7 +3454,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesGetAsync(string namespaceKey, string flagKey, string id, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -3519,14 +3519,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -3544,7 +3544,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -3604,7 +3604,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -3622,7 +3622,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesPutAsync(string namespaceKey, string flagKey, string id, RuleUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -3689,7 +3689,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -3707,7 +3707,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsGetAsync(string namespaceKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -3775,14 +3775,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -3800,7 +3800,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsPostAsync(string namespaceKey, SegmentCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -3857,14 +3857,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -3882,7 +3882,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsGetAsync(string namespaceKey, string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -3942,14 +3942,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -3967,7 +3967,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsDeleteAsync(string namespaceKey, string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -4022,7 +4022,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -4040,7 +4040,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsPutAsync(string namespaceKey, string key, SegmentUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -4101,14 +4101,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -4126,7 +4126,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsPostAsync(string namespaceKey, string flagKey, VariantCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -4188,14 +4188,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -4213,7 +4213,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -4273,7 +4273,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -4291,7 +4291,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// A server side error occurred. + /// A server side error occurred. public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsPutAsync(string namespaceKey, string flagKey, string id, VariantUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) @@ -4357,14 +4357,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { - throw new FliptException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -4414,7 +4414,7 @@ protected virtual async System.Threading.Tasks.Task> Rea catch (System.Text.Json.JsonException exception) { var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new FliptException(message, (int)response.StatusCode, responseText, headers, exception); + throw new FliptRestException(message, (int)response.StatusCode, responseText, headers, exception); } } else @@ -4430,7 +4430,7 @@ protected virtual async System.Threading.Tasks.Task> Rea catch (System.Text.Json.JsonException exception) { var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new FliptException(message, (int)response.StatusCode, string.Empty, headers, exception); + throw new FliptRestException(message, (int)response.StatusCode, string.Empty, headers, exception); } } } @@ -6146,7 +6146,7 @@ public System.Collections.Generic.IDictionary AdditionalProperti [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class FliptException : System.Exception + public partial class FliptRestException : System.Exception { public int StatusCode { get; private set; } @@ -6154,7 +6154,7 @@ public partial class FliptException : System.Exception public System.Collections.Generic.IReadOnlyDictionary> Headers { get; private set; } - public FliptException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Exception innerException) + public FliptRestException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Exception innerException) : base(message + "\n\nStatus: " + statusCode + "\nResponse: \n" + ((response == null) ? "(null)" : response.Substring(0, response.Length >= 512 ? 512 : response.Length)), innerException) { StatusCode = statusCode; @@ -6169,11 +6169,11 @@ public override string ToString() } [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class FliptException : FliptException + public partial class FliptRestException : FliptRestException { public TResult Result { get; private set; } - public FliptException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, TResult result, System.Exception innerException) + public FliptRestException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, TResult result, System.Exception innerException) : base(message, statusCode, response, headers, innerException) { Result = result; diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs index 6ecf8a03..7fc9094f 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs @@ -77,9 +77,9 @@ public async Task> EvaluateAsync(string flagKey, T defau return new ResolutionDetails(flagKey, defaultValue, ErrorType.TypeMismatch, Reason.Error); } } - catch (FliptException ex) + catch (FliptRestException ex) { - return ResolutionDetailFromFliptException(ex, flagKey, defaultValue); + return ResolutionDetailFromFliptRestException(ex, flagKey, defaultValue); } return new ResolutionDetails(flagKey, defaultValue, ErrorType.General, Reason.Unknown); @@ -102,13 +102,13 @@ public async Task> EvaluateBooleanAsync(string flagKey, return new ResolutionDetails(flagKey, boolEvaluationResponse.Enabled, ErrorType.None, Reason.TargetingMatch); } - catch (FliptException ex) + catch (FliptRestException ex) { - return ResolutionDetailFromFliptException(ex, flagKey, defaultValue); + return ResolutionDetailFromFliptRestException(ex, flagKey, defaultValue); } } - private static ResolutionDetails ResolutionDetailFromFliptException(FliptException e, string flagKey, + private static ResolutionDetails ResolutionDetailFromFliptRestException(FliptRestException e, string flagKey, T defaultValue) { var error = (HttpStatusCode)e.StatusCode switch @@ -131,19 +131,19 @@ public interface IFliptToOpenFeatureConverter /// /// Used for evaluating non-boolean flags. Flipt handles datatypes which is not boolean as variants /// - /// Key of the flag to evaluate - /// Fallback value in case of error, or flag not present or disabled, or no match - /// Additional data to use to filter and segment requests - /// Type to evaluate. For boolean use EvaluateBoolean + /// + /// + /// + /// /// OpenFeature ResolutionDetails object Task> EvaluateAsync(string flagKey, T defaultValue, EvaluationContext context = null); /// /// Used for evaluating boolean flags /// - /// Key of the flag to evaluate - /// Fallback value in case of error, or flag not present, or no match - /// Additional data to use to filter and segment requests + /// + /// + /// /// OpenFeature ResolutionDetails object Task> EvaluateBooleanAsync(string flagKey, bool defaultValue, EvaluationContext context = null); diff --git a/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj b/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj index 6a48e18f..a4c22b23 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj +++ b/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj @@ -10,12 +10,16 @@ Jean Andrei de la Cruz Austria + + + + + - + - net8.0 latest diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs index 3a0a2de3..506e258e 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs @@ -24,7 +24,7 @@ public async Task EvaluateBooleanAsync_GivenHttpRequestException_ShouldHandleHtt var mockFliptClientWrapper = new Mock(); mockFliptClientWrapper.Setup(fcw => fcw.EvaluateBooleanAsync(It.IsAny())) - .ThrowsAsync(new FliptException("", (int)thrownStatusCode, "", null, null)); + .ThrowsAsync(new FliptRestException("", (int)thrownStatusCode, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); var resolution = await fliptToOpenFeature.EvaluateBooleanAsync("flagKey", fallbackValue); @@ -64,7 +64,7 @@ public async Task EvaluateBooleanAsync_GivenNonExistentFlag_ShouldReturnDefaultV { var mockFliptClientWrapper = new Mock(); mockFliptClientWrapper.Setup(fcw => fcw.EvaluateBooleanAsync(It.IsAny())) - .ThrowsAsync(new FliptException("", (int)HttpStatusCode.NotFound, "", null, null)); + .ThrowsAsync(new FliptRestException("", (int)HttpStatusCode.NotFound, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); var resolution = await fliptToOpenFeature.EvaluateBooleanAsync("show-feature", fallBackValue); @@ -89,7 +89,7 @@ public async Task EvaluateAsync_GivenHttpRequestException_ShouldHandleHttpReques var mockFliptClientWrapper = new Mock(); mockFliptClientWrapper.Setup(fcw => fcw.EvaluateVariantAsync(It.IsAny())) - .ThrowsAsync(new FliptException("", (int)thrownStatusCode, "", null, null)); + .ThrowsAsync(new FliptRestException("", (int)thrownStatusCode, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); var resolution = await fliptToOpenFeature.EvaluateAsync("flagKey", fallbackValue); @@ -175,7 +175,7 @@ public async Task })); var mockFliptClientWrapper = new Mock(); mockFliptClientWrapper.Setup(fcw => fcw.EvaluateVariantAsync(It.IsAny())) - .ThrowsAsync(new FliptException("", (int)HttpStatusCode.NotFound, "", null, null)); + .ThrowsAsync(new FliptRestException("", (int)HttpStatusCode.NotFound, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); var resolution = await fliptToOpenFeature.EvaluateAsync("non-existent-flag", fallbackValue); @@ -194,7 +194,7 @@ public async Task var fallbackValue = new Value(""); var mockFliptClientWrapper = new Mock(); mockFliptClientWrapper.Setup(fcw => fcw.EvaluateVariantAsync(It.IsAny())) - .ThrowsAsync(new FliptException("", (int)HttpStatusCode.NotFound, "", null, null)); + .ThrowsAsync(new FliptRestException("", (int)HttpStatusCode.NotFound, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); var resolution = await fliptToOpenFeature.EvaluateAsync("non-existent-flag", fallbackValue); diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj b/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj index 77a272fe..7acc2090 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj @@ -1,7 +1,6 @@ - net8.0 enable enable From 2417a9ab49cffb80a4bb80c7826c6f605eb8ce59 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Thu, 3 Oct 2024 15:48:36 +0200 Subject: [PATCH 23/47] FliptProvider: Update Readme Signed-off-by: Andrei de la Cruz --- .../README.md | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) diff --git a/src/OpenFeature.Contrib.Providers.Flipt/README.md b/src/OpenFeature.Contrib.Providers.Flipt/README.md index e69de29b..5c9c7a23 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/README.md +++ b/src/OpenFeature.Contrib.Providers.Flipt/README.md @@ -0,0 +1,129 @@ +# Flipt .NET Provider + +The flipt provider allows you to connect to your Flipt instance through the OpenFeature SDK + +# .Net SDK usage + +## Requirements + +- open-feature/dotnet-sdk v1.5.0 > v2.0.0 + +## Install dependencies + +The first things we will do is install the **Open Feature SDK** and the **Flipt Feature Flag provider**. + +### .NET Cli + +```shell +dotnet add package OpenFeature.Contrib.Providers.Flipt +``` + +### Package Manager + +```shell +NuGet\Install-Package OpenFeature.Contrib.Providers.Flipt +``` + +### Package Reference + +```xml + +``` + +### Packet cli + +```shell +packet add OpenFeature.Contrib.Providers.Flipt +``` + +### Cake + +```shell +// Install OpenFeature.Contrib.Providers.Flipt as a Cake Addin +#addin nuget:?package=OpenFeature.Contrib.Providers.Flipt + +// Install OpenFeature.Contrib.Providers.Flipt as a Cake Tool +#tool nuget:?package=OpenFeature.Contrib.Providers.Flipt +``` + +## Using the Flipt Provider with the OpenFeature SDK + +To create a Flagmith provider you should define provider and Flipt settings. + +```csharp +using OpenFeature.Contrib.Providers.Flipt; +using OpenFeature.Model; + +var featureProvider = new FliptProvider("http://localhost:8080", "default-namespace"); + +// Set the featureProvider as the provider for the OpenFeature SDK +await OpenFeature.Api.Instance.SetProviderAsync(featureProvider); + +// Get an OpenFeature client +var client = OpenFeature.Api.Instance.GetClient(); + +// Optional: set EntityId and updated context +var context = EvaluationContext.Builder() + .SetTargetingKey("flipt EntityId") + .Set("extra-data-1", "extra-data-1-value") + .Build(); + +// Evaluate a flag +var val = await client.GetBooleanValueAsync("myBoolFlag", false, context); + +// Print the value of the 'myBoolFlag' feature flag +Console.WriteLine(val); +``` + +# Contribution + +## Code setup + +Since the official [flipt-csharp](https://github.com/flipt-io/flipt-server-sdks/tree/main/flipt-csharp) only supports +dotnet 8.0, it was not utilized in this provider as OpenFeature aims to support a bigger range of dotnet versions. + +### Rest Client using OpenAPI + +To work around this incompatibility, the openapi specification of [Flipt](https://github.com/flipt-io/flipt-openapi) was +used to generate a REST client using [nswag](https://github.com/RicoSuter/NSwag). + +## Updating the REST Client + +To generate or update the Flipt REST client, follow these steps: + +### 1. Download the OpenAPI Specification + +First, download the latest `openapi.yml` file from the Flipt GitHub repository. This can be done manually or by using a +command like `curl`: + +``` + +curl https://raw.githubusercontent.com/flipt-io/flipt-openapi/main/openapi.yml -o openapi.yml +``` + +### 2. Generate the Client Code + +With the `openapi.yml` file in your working directory, run the following `nswag` command to generate the REST client +code. Make sure to correct the command as shown below: + +``` +nswag openapi2csclient /className:FliptRestClient /namespace:Flipt.Rest /input:"openapi.yml" /output:"./Flipt.Rest.Client.cs" /GenerateExceptionClasses:true /OperationGenerationMode:SingleClientFromPathSegments /JsonLibrary:SystemTextJson /GenerateOptionalParameters:true /GenerateDefaultValues:true /GenerateResponseClasses:true /GenerateClientInterfaces:true /GenerateClientClasses:true /GenerateDtoTypes:true /ExceptionClass:FliptRestException /GenerateNativeRecords:true /UseBaseUrl:false /GenerateBaseUrlProperty:false +``` + +#### Notes + +- Ensure the `nswag` CLI tool is correctly installed and accessible from your terminal or command prompt. +- The command provided generates a C# client for interacting with the Flipt API, leveraging the System.Text.Json library + for JSON serialization/deserialization. +- The generated client will include features such as exception classes, optional parameters, default values, response + classes, client interfaces, DTO types, and native records, according to the specified options. +- This process assumes you're working in a directory that contains the `openapi.yml` file and will generate the + `Flipt.Rest.Client.cs` file in the same directory. + +## Know issues and limitations + +- +In https://github.com/open-feature/dotnet-sdk-contrib/blob/204144f6df0dacf46e6d52d34dd6b5a223a853f4/src/OpenFeature.Contrib.Providers.Flipt/ClientWrapper/FliptClientWrapper.cs#L41-L47 +a new `HttpClient` is created. In the future it would be better to allow passing of `HttpConnectionFactory` to avoid +problems regarding socket starvation + From fd7210a1e9b9fe278db0c9996316c5ad8676dd8b Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Thu, 3 Oct 2024 16:13:15 +0200 Subject: [PATCH 24/47] FliptProvider: Update ReadMe, test fliptClientWrapper calls Signed-off-by: Andrei de la Cruz --- .../README.md | 4 +- .../FliptProviderTest.cs | 82 ++++++++++++++++++- .../FliptToOpenFeatureConverterTest.cs | 13 --- 3 files changed, 82 insertions(+), 17 deletions(-) diff --git a/src/OpenFeature.Contrib.Providers.Flipt/README.md b/src/OpenFeature.Contrib.Providers.Flipt/README.md index 5c9c7a23..48c7eeda 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/README.md +++ b/src/OpenFeature.Contrib.Providers.Flipt/README.md @@ -122,8 +122,8 @@ nswag openapi2csclient /className:FliptRestClient /namespace:Flipt.Rest /input:" ## Know issues and limitations -- -In https://github.com/open-feature/dotnet-sdk-contrib/blob/204144f6df0dacf46e6d52d34dd6b5a223a853f4/src/OpenFeature.Contrib.Providers.Flipt/ClientWrapper/FliptClientWrapper.cs#L41-L47 +-In `BuildClient()` method +from https://github.com/open-feature/dotnet-sdk-contrib/blob/204144f6df0dacf46e6d52d34dd6b5a223a853f4/src/OpenFeature.Contrib.Providers.Flipt/ClientWrapper/FliptClientWrapper.cs#L41-L47 a new `HttpClient` is created. In the future it would be better to allow passing of `HttpConnectionFactory` to avoid problems regarding socket starvation diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs index 2c809bc7..d95ae8f5 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs @@ -38,7 +38,7 @@ public async Task .ReturnsAsync(new VariantEvaluationResponse { FlagKey = flagKey, - VariantKey = "iamastring", + VariantKey = "variant-key", RequestId = Guid.NewGuid() .ToString(), SegmentKeys = ["segment1"], @@ -65,5 +65,83 @@ public async Task valueResolution.ErrorType.Should().Be(ErrorType.TypeMismatch); } - // Todo Andrei: Add tests to make sure that the wrapper was called + [Fact] + public async Task ResolveStringValueAsync_WhenCalled_ShouldCallCorrectMethodFromFliptClientWrapper() + { + const string flagKey = "feature-flag-key"; + var (provider, mockFliptClientWrapper) = GenerateFliptProviderWithMockedDependencies(flagKey); + await provider.ResolveStringValueAsync(flagKey, ""); + mockFliptClientWrapper.Verify( + fcw => fcw.EvaluateVariantAsync(It.Is(er => er.FlagKey == flagKey)), Times.Once); + } + + [Fact] + public async Task ResolveDoubleValueAsync_WhenCalled_ShouldCallCorrectMethodFromFliptClientWrapper() + { + const string flagKey = "feature-flag-key"; + var (provider, mockFliptClientWrapper) = GenerateFliptProviderWithMockedDependencies(flagKey); + await provider.ResolveDoubleValueAsync(flagKey, 0.0); + mockFliptClientWrapper.Verify( + fcw => fcw.EvaluateVariantAsync(It.Is(er => er.FlagKey == flagKey)), Times.Once); + } + + [Fact] + public async Task ResolveIntegerValueAsync_WhenCalled_ShouldCallCorrectMethodFromFliptClientWrapper() + { + const string flagKey = "feature-flag-key"; + var (provider, mockFliptClientWrapper) = GenerateFliptProviderWithMockedDependencies(flagKey); + await provider.ResolveIntegerValueAsync(flagKey, 0); + mockFliptClientWrapper.Verify( + fcw => fcw.EvaluateVariantAsync(It.Is(er => er.FlagKey == flagKey)), Times.Once); + } + + [Fact] + public async Task ResolveStructureValueAsync_WhenCalled_ShouldCallCorrectMethodFromFliptClientWrapper() + { + const string flagKey = "feature-flag-key"; + var (provider, mockFliptClientWrapper) = GenerateFliptProviderWithMockedDependencies(flagKey); + await provider.ResolveStructureValueAsync(flagKey, new Value()); + mockFliptClientWrapper.Verify( + fcw => fcw.EvaluateVariantAsync(It.Is(er => er.FlagKey == flagKey)), Times.Once); + } + + [Fact] + public async Task ResolveBooleanValueAsync_WhenCalled_ShouldCallCorrectMethodFromFliptClientWrapper() + { + const string flagKey = "feature-flag-key"; + var (provider, mockFliptClientWrapper) = GenerateFliptProviderWithMockedDependencies(flagKey); + await provider.ResolveBooleanValueAsync(flagKey, false); + mockFliptClientWrapper.Verify( + fcw => fcw.EvaluateBooleanAsync(It.Is(er => er.FlagKey == flagKey)), Times.Once); + } + + private (FliptProvider, Mock) GenerateFliptProviderWithMockedDependencies(string flagKey) + { + var mockFliptClientWrapper = new Mock(); + mockFliptClientWrapper.Setup(fcw => fcw.EvaluateVariantAsync(It.IsAny())) + .ReturnsAsync(new VariantEvaluationResponse + { + FlagKey = flagKey, + VariantKey = "variant-key", + RequestId = Guid.NewGuid() + .ToString(), + SegmentKeys = ["segment1"], + VariantAttachment = "", + Match = true, + Reason = EvaluationReason.MATCH_EVALUATION_REASON + }); + + mockFliptClientWrapper.Setup(fcw => fcw.EvaluateBooleanAsync(It.IsAny())) + .ReturnsAsync(new BooleanEvaluationResponse + { + FlagKey = flagKey, + RequestId = Guid.NewGuid() + .ToString(), + Enabled = true, + Reason = EvaluationReason.MATCH_EVALUATION_REASON + }); + + return (new FliptProvider(new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object)), + mockFliptClientWrapper); + } } \ No newline at end of file diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs index 506e258e..5c55590f 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs @@ -204,17 +204,4 @@ public async Task resolution.Value.Should().BeEquivalentTo(fallbackValue); resolution.ErrorType.Should().Be(ErrorType.FlagNotFound); } - - /* Todo Andrei: Mga kulang pa na unit test - - Successful na flag - - Boolean - - Variant and other types - - Wrong flag name - - Boolean - - Variant - - Type mismatch call - - Strategy: - 1. I-mock lang return type ni Flipt - */ } \ No newline at end of file From 328c5a10d2291475216c354f58dc11cb255fb7b2 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Thu, 3 Oct 2024 16:20:05 +0200 Subject: [PATCH 25/47] FliptProvider: Removed wrong code change in a different project Signed-off-by: Andrei de la Cruz --- ...Feature.Contrib.Providers.Flagsmith.csproj | 52 +++++++++---------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/src/OpenFeature.Contrib.Providers.Flagsmith/OpenFeature.Contrib.Providers.Flagsmith.csproj b/src/OpenFeature.Contrib.Providers.Flagsmith/OpenFeature.Contrib.Providers.Flagsmith.csproj index 38e8c260..945b78b8 100644 --- a/src/OpenFeature.Contrib.Providers.Flagsmith/OpenFeature.Contrib.Providers.Flagsmith.csproj +++ b/src/OpenFeature.Contrib.Providers.Flagsmith/OpenFeature.Contrib.Providers.Flagsmith.csproj @@ -1,35 +1,31 @@  - - OpenFeature.Contrib.Providers.Flagsmith - 0.2.0 - $(VersionNumber) - $(VersionNumber) - $(VersionNumber) - Flagsmith provider for .NET - Vladimir Petrusevici - + + OpenFeature.Contrib.Providers.Flagsmith + 0.2.0 + $(VersionNumber) + $(VersionNumber) + $(VersionNumber) + Flagsmith provider for .NET + Vladimir Petrusevici + - - - - <_Parameter1>$(MSBuildProjectName).Test - - + + + + <_Parameter1>$(MSBuildProjectName).Test + + - - - + + + - - - + + + - - - - - - latest - + + latest + From 0dcca7eef1e270b96fe87a18f1f152394ccd1796 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Thu, 3 Oct 2024 19:08:46 +0200 Subject: [PATCH 26/47] lint Signed-off-by: Andrei de la Cruz --- .../FliptProvider.cs | 104 ++++++------- .../FliptToOpenFeatureConverter.cs | 146 +++++++++--------- .../FlipExtensionsTest.cs | 54 +++---- .../FliptProviderTest.cs | 2 +- .../FliptToOpenFeatureConverterTest.cs | 4 +- 5 files changed, 155 insertions(+), 155 deletions(-) diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptProvider.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptProvider.cs index 9c09e4b2..7dcd747d 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/FliptProvider.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptProvider.cs @@ -15,62 +15,62 @@ public class FliptProvider(IFliptToOpenFeatureConverter fliptToOpenFeatureConver { private static readonly Metadata Metadata = new("Flipt Provider"); - /// - /// Instantiate a FliptProvider using configuration params - /// - /// Url of flipt instance - /// Namespace used for querying flags - /// Authentication access token - /// Timeout when calling flipt endpoints in seconds - public FliptProvider(string fliptUrl, string namespaceKey = "default", string clientToken = "", - int timeoutInSeconds = 30) : this(new FliptToOpenFeatureConverter(fliptUrl, namespaceKey, clientToken, - timeoutInSeconds)) - { - } +/// +/// Instantiate a FliptProvider using configuration params +/// +/// Url of flipt instance +/// Namespace used for querying flags +/// Authentication access token +/// Timeout when calling flipt endpoints in seconds +public FliptProvider(string fliptUrl, string namespaceKey = "default", string clientToken = "", + int timeoutInSeconds = 30) : this(new FliptToOpenFeatureConverter(fliptUrl, namespaceKey, clientToken, + timeoutInSeconds)) +{ +} - /// - public override Metadata GetMetadata() - { - return Metadata; - } +/// +public override Metadata GetMetadata() +{ + return Metadata; +} - /// - public override async Task> ResolveBooleanValueAsync(string flagKey, bool defaultValue, - EvaluationContext context = null, - CancellationToken cancellationToken = new()) - { - return await fliptToOpenFeatureConverter.EvaluateBooleanAsync(flagKey, defaultValue, context); - } +/// +public override async Task> ResolveBooleanValueAsync(string flagKey, bool defaultValue, + EvaluationContext context = null, + CancellationToken cancellationToken = new()) +{ + return await fliptToOpenFeatureConverter.EvaluateBooleanAsync(flagKey, defaultValue, context); +} - /// - public override async Task> ResolveStringValueAsync(string flagKey, - string defaultValue, EvaluationContext context = null, - CancellationToken cancellationToken = new()) - { - return await fliptToOpenFeatureConverter.EvaluateAsync(flagKey, defaultValue, context); - } +/// +public override async Task> ResolveStringValueAsync(string flagKey, + string defaultValue, EvaluationContext context = null, + CancellationToken cancellationToken = new()) +{ + return await fliptToOpenFeatureConverter.EvaluateAsync(flagKey, defaultValue, context); +} - /// - public override async Task> ResolveIntegerValueAsync(string flagKey, int defaultValue, - EvaluationContext context = null, - CancellationToken cancellationToken = new()) - { - return await fliptToOpenFeatureConverter.EvaluateAsync(flagKey, defaultValue, context); - } +/// +public override async Task> ResolveIntegerValueAsync(string flagKey, int defaultValue, + EvaluationContext context = null, + CancellationToken cancellationToken = new()) +{ + return await fliptToOpenFeatureConverter.EvaluateAsync(flagKey, defaultValue, context); +} - /// - public override async Task> ResolveDoubleValueAsync(string flagKey, double defaultValue, - EvaluationContext context = null, - CancellationToken cancellationToken = new()) - { - return await fliptToOpenFeatureConverter.EvaluateAsync(flagKey, defaultValue, context); - } +/// +public override async Task> ResolveDoubleValueAsync(string flagKey, double defaultValue, + EvaluationContext context = null, + CancellationToken cancellationToken = new()) +{ + return await fliptToOpenFeatureConverter.EvaluateAsync(flagKey, defaultValue, context); +} - /// - public override async Task> ResolveStructureValueAsync(string flagKey, Value defaultValue, - EvaluationContext context = null, - CancellationToken cancellationToken = new()) - { - return await fliptToOpenFeatureConverter.EvaluateAsync(flagKey, defaultValue, context); - } +/// +public override async Task> ResolveStructureValueAsync(string flagKey, Value defaultValue, + EvaluationContext context = null, + CancellationToken cancellationToken = new()) +{ + return await fliptToOpenFeatureConverter.EvaluateAsync(flagKey, defaultValue, context); +} } \ No newline at end of file diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs index 7fc9094f..9f870235 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs @@ -28,101 +28,101 @@ public FliptToOpenFeatureConverter(string fliptUrl, string clientToken = "", int timeoutInSeconds = 30) : this(new FliptClientWrapper(fliptUrl, clientToken, timeoutInSeconds), namespaceKey) +{ +} + +/// +public async Task> EvaluateAsync(string flagKey, T defaultValue, + EvaluationContext context = null) +{ + var evaluationRequest = new EvaluationRequest { - } + NamespaceKey = namespaceKey, + FlagKey = flagKey, + EntityId = context?.TargetingKey ?? "", + Context = context.ToStringDictionary() + }; - /// - public async Task> EvaluateAsync(string flagKey, T defaultValue, - EvaluationContext context = null) + try { - var evaluationRequest = new EvaluationRequest - { - NamespaceKey = namespaceKey, - FlagKey = flagKey, - EntityId = context?.TargetingKey ?? "", - Context = context.ToStringDictionary() - }; + var evaluationResponse = await fliptClientWrapper.EvaluateVariantAsync(evaluationRequest); + + if (evaluationResponse.Reason == EvaluationReason.FLAG_DISABLED_EVALUATION_REASON) + return new ResolutionDetails(flagKey, defaultValue, ErrorType.None, + Reason.Disabled); + if (!evaluationResponse.Match) + return new ResolutionDetails(flagKey, defaultValue, ErrorType.None, + Reason.Default); try { - var evaluationResponse = await fliptClientWrapper.EvaluateVariantAsync(evaluationRequest); - - if (evaluationResponse.Reason == EvaluationReason.FLAG_DISABLED_EVALUATION_REASON) - return new ResolutionDetails(flagKey, defaultValue, ErrorType.None, - Reason.Disabled); - - if (!evaluationResponse.Match) - return new ResolutionDetails(flagKey, defaultValue, ErrorType.None, - Reason.Default); - try + if (string.IsNullOrEmpty(evaluationResponse.VariantAttachment)) { - if (string.IsNullOrEmpty(evaluationResponse.VariantAttachment)) - { - var convertedValue = (T)Convert.ChangeType(evaluationResponse.VariantKey, typeof(T)); - return new ResolutionDetails(flagKey, - convertedValue, ErrorType.None, - Reason.TargetingMatch, evaluationResponse.VariantKey); - } - - var deserializedValueObj = JsonSerializer.Deserialize(evaluationResponse.VariantAttachment, - JsonConverterExtensions.DefaultSerializerSettings); - + var convertedValue = (T)Convert.ChangeType(evaluationResponse.VariantKey, typeof(T)); return new ResolutionDetails(flagKey, - (T)Convert.ChangeType(deserializedValueObj, typeof(T)), - ErrorType.None, Reason.TargetingMatch, evaluationResponse.VariantKey); + convertedValue, ErrorType.None, + Reason.TargetingMatch, evaluationResponse.VariantKey); } - catch (Exception ex) - { - if (ex is InvalidCastException or FormatException) - return new ResolutionDetails(flagKey, defaultValue, ErrorType.TypeMismatch, Reason.Error); - } - } - catch (FliptRestException ex) - { - return ResolutionDetailFromFliptRestException(ex, flagKey, defaultValue); - } - return new ResolutionDetails(flagKey, defaultValue, ErrorType.General, Reason.Unknown); - } + var deserializedValueObj = JsonSerializer.Deserialize(evaluationResponse.VariantAttachment, + JsonConverterExtensions.DefaultSerializerSettings); - /// - public async Task> EvaluateBooleanAsync(string flagKey, bool defaultValue, - EvaluationContext context = null) - { - try - { - var evaluationRequest = new EvaluationRequest - { - NamespaceKey = namespaceKey, - FlagKey = flagKey, - EntityId = context?.TargetingKey ?? "", - Context = context.ToStringDictionary() - }; - var boolEvaluationResponse = await fliptClientWrapper.EvaluateBooleanAsync(evaluationRequest); - return new ResolutionDetails(flagKey, boolEvaluationResponse.Enabled, ErrorType.None, - Reason.TargetingMatch); + return new ResolutionDetails(flagKey, + (T)Convert.ChangeType(deserializedValueObj, typeof(T)), + ErrorType.None, Reason.TargetingMatch, evaluationResponse.VariantKey); } - catch (FliptRestException ex) + catch (Exception ex) { - return ResolutionDetailFromFliptRestException(ex, flagKey, defaultValue); + if (ex is InvalidCastException or FormatException) + return new ResolutionDetails(flagKey, defaultValue, ErrorType.TypeMismatch, Reason.Error); } } + catch (FliptRestException ex) + { + return ResolutionDetailFromFliptRestException(ex, flagKey, defaultValue); + } + + return new ResolutionDetails(flagKey, defaultValue, ErrorType.General, Reason.Unknown); +} - private static ResolutionDetails ResolutionDetailFromFliptRestException(FliptRestException e, string flagKey, - T defaultValue) +/// +public async Task> EvaluateBooleanAsync(string flagKey, bool defaultValue, + EvaluationContext context = null) +{ + try { - var error = (HttpStatusCode)e.StatusCode switch + var evaluationRequest = new EvaluationRequest { - HttpStatusCode.NotFound => ErrorType.FlagNotFound, - HttpStatusCode.BadRequest => ErrorType.TypeMismatch, - HttpStatusCode.Forbidden => ErrorType.ProviderNotReady, - HttpStatusCode.InternalServerError => ErrorType.ProviderNotReady, - _ => ErrorType.General + NamespaceKey = namespaceKey, + FlagKey = flagKey, + EntityId = context?.TargetingKey ?? "", + Context = context.ToStringDictionary() }; - return new ResolutionDetails(flagKey, defaultValue, error, errorMessage: e.Message, reason: Reason.Error); + var boolEvaluationResponse = await fliptClientWrapper.EvaluateBooleanAsync(evaluationRequest); + return new ResolutionDetails(flagKey, boolEvaluationResponse.Enabled, ErrorType.None, + Reason.TargetingMatch); + } + catch (FliptRestException ex) + { + return ResolutionDetailFromFliptRestException(ex, flagKey, defaultValue); } } +private static ResolutionDetails ResolutionDetailFromFliptRestException(FliptRestException e, string flagKey, + T defaultValue) +{ + var error = (HttpStatusCode)e.StatusCode switch + { + HttpStatusCode.NotFound => ErrorType.FlagNotFound, + HttpStatusCode.BadRequest => ErrorType.TypeMismatch, + HttpStatusCode.Forbidden => ErrorType.ProviderNotReady, + HttpStatusCode.InternalServerError => ErrorType.ProviderNotReady, + _ => ErrorType.General + }; + return new ResolutionDetails(flagKey, defaultValue, error, errorMessage: e.Message, reason: Reason.Error); +} +} + /// /// Contract for fliptClient wrapper /// diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs index 5ef601ba..57aa31ae 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs @@ -110,27 +110,27 @@ public void ToStringDictionary_WithContextWithListAndNestedList_ShouldReturnADic ]) }, { "config3", new Value(DateTime.Now) } - }); +}); - var evaluationContext = EvaluationContext.Builder() - .SetTargetingKey(Guid.NewGuid().ToString()) - .Set("config", testStructure) - .Build(); - var result = evaluationContext.ToStringDictionary(); +var evaluationContext = EvaluationContext.Builder() + .SetTargetingKey(Guid.NewGuid().ToString()) + .Set("config", testStructure) + .Build(); +var result = evaluationContext.ToStringDictionary(); - result.Should().NotBeNull(); - result.Should().NotBeEmpty(); - result.Keys.Should().Contain("config"); +result.Should().NotBeNull(); +result.Should().NotBeEmpty(); +result.Keys.Should().Contain("config"); - var deserialized = JsonSerializer.Deserialize(result["config"], - JsonConverterExtensions.DefaultSerializerSettings); - deserialized.Should().BeEquivalentTo(testStructure); +var deserialized = JsonSerializer.Deserialize(result["config"], + JsonConverterExtensions.DefaultSerializerSettings); +deserialized.Should().BeEquivalentTo(testStructure); } [Fact] - public void ToStringDictionary_WithContextWithNestedStructure_ShouldReturnADictionaryWithSerializedValues() - { - var testStructure = new Structure(new Dictionary +public void ToStringDictionary_WithContextWithNestedStructure_ShouldReturnADictionaryWithSerializedValues() +{ + var testStructure = new Structure(new Dictionary { { "config-value-struct", new Value(new Structure(new Dictionary @@ -141,18 +141,18 @@ public void ToStringDictionary_WithContextWithNestedStructure_ShouldReturnADicti { "config-value-value", new Value(new Value(DateTime.Now)) } }); - var evaluationContext = EvaluationContext.Builder() - .SetTargetingKey(Guid.NewGuid().ToString()) - .Set("config", testStructure) - .Build(); - var result = evaluationContext.ToStringDictionary(); + var evaluationContext = EvaluationContext.Builder() + .SetTargetingKey(Guid.NewGuid().ToString()) + .Set("config", testStructure) + .Build(); + var result = evaluationContext.ToStringDictionary(); - result.Should().NotBeNull(); - result.Should().NotBeEmpty(); - result.Keys.Should().Contain("config"); + result.Should().NotBeNull(); + result.Should().NotBeEmpty(); + result.Keys.Should().Contain("config"); - var deserialized = JsonSerializer.Deserialize(result["config"], - JsonConverterExtensions.DefaultSerializerSettings); - deserialized.Should().BeEquivalentTo(testStructure); - } + var deserialized = JsonSerializer.Deserialize(result["config"], + JsonConverterExtensions.DefaultSerializerSettings); + deserialized.Should().BeEquivalentTo(testStructure); +} } \ No newline at end of file diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs index d95ae8f5..7ff001c9 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs @@ -23,7 +23,7 @@ public void CreateFliptProvider_ShouldReturnFliptProvider() [Fact] public void CreateFliptProvider_GivenEmptyUrl_ShouldThrowInvalidOperationException() { - var act = void () => new FliptProvider(""); + var act = void() => new FliptProvider(""); act.Should().Throw(); } diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs index 5c55590f..006d0c6d 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs @@ -134,10 +134,10 @@ public async Task EvaluateAsync_GivenExistingVariantFlagAndWithAnObject_ShouldRe const string variantKey = "variant-A"; const string valueFromSrc = """ { - "name": "Mr. Robinson", + "name": "Mr. Robinson", "age": 12, } - """; + """; var expectedValue = new Value(new Structure(new Dictionary { { "name", new Value("Mr. Robinson") }, { "age", new Value(12) } From cc8a209563a9c55ca3f6f6256479cad798985e09 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Thu, 3 Oct 2024 19:33:22 +0200 Subject: [PATCH 27/47] Used HttpStatusCode.Ambiguous because TooManyRequests is not yet implemented in .net 4.6 Signed-off-by: Andrei de la Cruz --- .../FliptToOpenFeatureConverterTest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs index 006d0c6d..d158d9e7 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs @@ -17,7 +17,7 @@ public class FliptToOpenFeatureConverterTest [InlineData(HttpStatusCode.BadRequest, ErrorType.TypeMismatch, false)] [InlineData(HttpStatusCode.InternalServerError, ErrorType.ProviderNotReady, false)] [InlineData(HttpStatusCode.Forbidden, ErrorType.ProviderNotReady, false)] - [InlineData(HttpStatusCode.TooManyRequests, ErrorType.General, false)] + [InlineData(HttpStatusCode.Ambiguous, ErrorType.General, false)] public async Task EvaluateBooleanAsync_GivenHttpRequestException_ShouldHandleHttpRequestException( HttpStatusCode thrownStatusCode, ErrorType expectedOpenFeatureErrorType, bool fallbackValue) { @@ -82,7 +82,7 @@ public async Task EvaluateBooleanAsync_GivenNonExistentFlag_ShouldReturnDefaultV [InlineData(HttpStatusCode.BadRequest, ErrorType.TypeMismatch, 0.0)] [InlineData(HttpStatusCode.InternalServerError, ErrorType.ProviderNotReady, 0.0)] [InlineData(HttpStatusCode.Forbidden, ErrorType.ProviderNotReady, 0.0)] - [InlineData(HttpStatusCode.TooManyRequests, ErrorType.General, 0.0)] + [InlineData(HttpStatusCode.Ambiguous, ErrorType.General, 0.0)] public async Task EvaluateAsync_GivenHttpRequestException_ShouldHandleHttpRequestException( HttpStatusCode thrownStatusCode, ErrorType expectedOpenFeatureErrorType, double fallbackValue) { From c3d28b83c880e7031b2505fdaa3ecf0e125c3b8a Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Fri, 4 Oct 2024 01:00:48 +0200 Subject: [PATCH 28/47] FliptProvider: Updated openapi.yaml src, regenerated RestClient using new openapi spec, removed typos in readme, unit test updates Signed-off-by: Andrei de la Cruz --- .../Flipt.Rest.Client.cs | 3457 ++++++++++------- .../FliptToOpenFeatureConverter.cs | 2 +- .../README.md | 15 +- .../openapi.yaml | 2310 +++++++++++ .../openapi.yml | 2225 ----------- .../FliptProviderTest.cs | 8 +- .../FliptToOpenFeatureConverterTest.cs | 14 +- 7 files changed, 4359 insertions(+), 3672 deletions(-) create mode 100644 src/OpenFeature.Contrib.Providers.Flipt/openapi.yaml delete mode 100644 src/OpenFeature.Contrib.Providers.Flipt/openapi.yml diff --git a/src/OpenFeature.Contrib.Providers.Flipt/Flipt.Rest.Client.cs b/src/OpenFeature.Contrib.Providers.Flipt/Flipt.Rest.Client.cs index f9606366..3f7f5057 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/Flipt.Rest.Client.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/Flipt.Rest.Client.cs @@ -27,204 +27,268 @@ public partial interface IFliptRestClient { /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task EvaluateV1BooleanAsync(EvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesGetAsync(int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task EvaluateV1VariantAsync(EvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesPostAsync(CreateNamespaceRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task EvaluateV1BatchAsync(BatchEvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesGetAsync(string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task AuthV1MethodKubernetesServiceaccountAsync(Body body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesPutAsync(string key, UpdateNamespaceRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task AuthV1MethodOidcAuthorizeAsync(string provider, string state, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesDeleteAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task AuthV1MethodOidcCallbackAsync(string provider, string code, string state, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesFlagsGetAsync(string namespaceKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task AuthV1MethodTokenAsync(Body2 body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesFlagsPostAsync(string namespaceKey, CreateFlagRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task AuthV1TokensGetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsGetAsync(string namespaceKey, string flagKey, int? limit = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task AuthV1TokensGetAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsPostAsync(string namespaceKey, string flagKey, CreateRolloutRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task AuthV1TokensDeleteAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsOrderAsync(string namespaceKey, string flagKey, OrderRolloutsRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task AuthV1SelfAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsGetAsync(string namespaceKey, string flagKey, string id, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task AuthV1SelfExpireAsync(Body3 body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsPutAsync(string namespaceKey, string flagKey, string id, UpdateRolloutRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsPostAsync(string namespaceKey, string segmentKey, ConstraintCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsDeleteAsync(string namespaceKey, string segmentKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesGetAsync(string namespaceKey, string flagKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsPutAsync(string namespaceKey, string segmentKey, string id, ConstraintUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesPostAsync(string namespaceKey, string flagKey, CreateRuleRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsPostAsync(string namespaceKey, string flagKey, string ruleId, DistributionCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesOrderAsync(string namespaceKey, string flagKey, OrderRulesRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsDeleteAsync(string namespaceKey, string flagKey, string ruleId, string id, string variantId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesGetAsync(string namespaceKey, string flagKey, string id, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsPutAsync(string namespaceKey, string flagKey, string ruleId, string id, DistributionUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesPutAsync(string namespaceKey, string flagKey, string id, UpdateRuleRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesEvaluateAsync(string namespaceKey, EvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesBatchEvaluateAsync(string namespaceKey, BatchEvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsPostAsync(string namespaceKey, string flagKey, string ruleId, CreateDistributionRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsGetAsync(string namespaceKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsPutAsync(string namespaceKey, string flagKey, string ruleId, string id, UpdateDistributionRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsPostAsync(string namespaceKey, FlagCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsDeleteAsync(string namespaceKey, string flagKey, string ruleId, string id, string variantId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsGetAsync(string namespaceKey, string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsPostAsync(string namespaceKey, string flagKey, CreateVariantRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsDeleteAsync(string namespaceKey, string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsPutAsync(string namespaceKey, string flagKey, string id, UpdateVariantRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsPutAsync(string namespaceKey, string key, FlagUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesGetAsync(int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesFlagsGetAsync(string namespaceKey, string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesPostAsync(NamespaceCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesFlagsPutAsync(string namespaceKey, string key, UpdateFlagRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesGetAsync(string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesFlagsDeleteAsync(string namespaceKey, string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesDeleteAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesSegmentsGetAsync(string namespaceKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesPutAsync(string key, NamespaceUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesSegmentsPostAsync(string namespaceKey, CreateSegmentRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsGetAsync(string namespaceKey, string flagKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesSegmentsGetAsync(string namespaceKey, string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsPostAsync(string namespaceKey, string flagKey, RolloutCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesSegmentsPutAsync(string namespaceKey, string key, UpdateSegmentRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsOrderAsync(string namespaceKey, string flagKey, RolloutOrderRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesSegmentsDeleteAsync(string namespaceKey, string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsGetAsync(string namespaceKey, string flagKey, string id, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsPostAsync(string namespaceKey, string segmentKey, CreateConstraintRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsPutAsync(string namespaceKey, string segmentKey, string id, UpdateConstraintRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsPutAsync(string namespaceKey, string flagKey, string id, RolloutUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsDeleteAsync(string namespaceKey, string segmentKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesGetAsync(string namespaceKey, string flagKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task AuthV1MethodKubernetesServiceaccountAsync(VerifyServiceAccountRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesPostAsync(string namespaceKey, string flagKey, RuleCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task AuthV1MethodOidcAuthorizeAsync(string provider, string state = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesOrderAsync(string namespaceKey, string flagKey, RuleOrderRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task AuthV1MethodOidcCallbackAsync(string provider, string code = null, string state = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesGetAsync(string namespaceKey, string flagKey, string id, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task AuthV1MethodTokenAsync(CreateTokenRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task AuthV1SelfAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesPutAsync(string namespaceKey, string flagKey, string id, RuleUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task AuthV1SelfExpireAsync(System.DateTimeOffset? expiresAt = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesSegmentsGetAsync(string namespaceKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task AuthV1TokensGetAsync(Method? method = null, int? limit = null, string pageToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesSegmentsPostAsync(string namespaceKey, SegmentCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task AuthV1TokensGetAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesSegmentsGetAsync(string namespaceKey, string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task AuthV1TokensDeleteAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesSegmentsDeleteAsync(string namespaceKey, string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task EvaluateV1BatchAsync(BatchEvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesSegmentsPutAsync(string namespaceKey, string key, SegmentUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task EvaluateV1BooleanAsync(EvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsPostAsync(string namespaceKey, string flagKey, VariantCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task EvaluateV1VariantAsync(EvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// OFREP provider configuration + /// + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task OfrepV1ConfigurationAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// OFREP bulk flag evaluation + /// + /// OK /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsPutAsync(string namespaceKey, string flagKey, string id, VariantUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task OfrepV1EvaluateFlagsPostAsync(EvaluateBulkRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// OFREP single flag evaluation + /// + /// OK + /// A server side error occurred. + System.Threading.Tasks.Task OfrepV1EvaluateFlagsPostAsync(string key, EvaluateFlagRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } @@ -261,29 +325,41 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task EvaluateV1BooleanAsync(EvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesGetAsync(int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (body == null) - throw new System.ArgumentNullException("body"); - var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Method = new System.Net.Http.HttpMethod("GET"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "evaluate/v1/boolean" - urlBuilder_.Append("evaluate/v1/boolean"); + // Operation Path: "api/v1/namespaces" + urlBuilder_.Append("api/v1/namespaces"); + urlBuilder_.Append('?'); + if (limit != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (offset != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (pageToken != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("pageToken")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(pageToken, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (reference != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; PrepareRequest(client_, request_, urlBuilder_); @@ -310,7 +386,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -338,8 +414,9 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task EvaluateV1VariantAsync(EvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesPostAsync(CreateNamespaceRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (body == null) throw new System.ArgumentNullException("body"); @@ -359,8 +436,8 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "evaluate/v1/variant" - urlBuilder_.Append("evaluate/v1/variant"); + // Operation Path: "api/v1/namespaces" + urlBuilder_.Append("api/v1/namespaces"); PrepareRequest(client_, request_, urlBuilder_); @@ -387,7 +464,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -415,11 +492,12 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task EvaluateV1BatchAsync(BatchEvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesGetAsync(string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (body == null) - throw new System.ArgumentNullException("body"); + if (key == null) + throw new System.ArgumentNullException("key"); var client_ = _httpClient; var disposeClient_ = false; @@ -427,17 +505,20 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Method = new System.Net.Http.HttpMethod("GET"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "evaluate/v1/batch" - urlBuilder_.Append("evaluate/v1/batch"); + // Operation Path: "api/v1/namespaces/{key}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append('?'); + if (reference != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; PrepareRequest(client_, request_, urlBuilder_); @@ -464,7 +545,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -492,9 +573,13 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task AuthV1MethodKubernetesServiceaccountAsync(Body body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesPutAsync(string key, UpdateNamespaceRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (key == null) + throw new System.ArgumentNullException("key"); + if (body == null) throw new System.ArgumentNullException("body"); @@ -508,13 +593,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var content_ = new System.Net.Http.ByteArrayContent(json_); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Method = new System.Net.Http.HttpMethod("PUT"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "auth/v1/method/kubernetes/serviceaccount" - urlBuilder_.Append("auth/v1/method/kubernetes/serviceaccount"); + // Operation Path: "api/v1/namespaces/{key}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); PrepareRequest(client_, request_, urlBuilder_); @@ -541,7 +627,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -569,14 +655,12 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task AuthV1MethodOidcAuthorizeAsync(string provider, string state, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesDeleteAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (provider == null) - throw new System.ArgumentNullException("provider"); - - if (state == null) - throw new System.ArgumentNullException("state"); + if (key == null) + throw new System.ArgumentNullException("key"); var client_ = _httpClient; var disposeClient_ = false; @@ -584,18 +668,13 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + request_.Method = new System.Net.Http.HttpMethod("DELETE"); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "auth/v1/method/oidc/{provider}/authorize" - urlBuilder_.Append("auth/v1/method/oidc/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(provider, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/authorize"); - urlBuilder_.Append('?'); - urlBuilder_.Append(System.Uri.EscapeDataString("state")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(state, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - urlBuilder_.Length--; + // Operation Path: "api/v1/namespaces/{key}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); PrepareRequest(client_, request_, urlBuilder_); @@ -622,12 +701,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; + return; } else { @@ -650,17 +724,12 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task AuthV1MethodOidcCallbackAsync(string provider, string code, string state, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsGetAsync(string namespaceKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (provider == null) - throw new System.ArgumentNullException("provider"); - - if (code == null) - throw new System.ArgumentNullException("code"); - - if (state == null) - throw new System.ArgumentNullException("state"); + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); var client_ = _httpClient; var disposeClient_ = false; @@ -673,13 +742,27 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "auth/v1/method/oidc/{provider}/callback" - urlBuilder_.Append("auth/v1/method/oidc/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(provider, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/callback"); + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags"); urlBuilder_.Append('?'); - urlBuilder_.Append(System.Uri.EscapeDataString("code")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(code, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - urlBuilder_.Append(System.Uri.EscapeDataString("state")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(state, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + if (limit != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (offset != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (pageToken != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("pageToken")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(pageToken, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (reference != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } urlBuilder_.Length--; PrepareRequest(client_, request_, urlBuilder_); @@ -707,7 +790,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -735,9 +818,13 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task AuthV1MethodTokenAsync(Body2 body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsPostAsync(string namespaceKey, CreateFlagRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + if (body == null) throw new System.ArgumentNullException("body"); @@ -756,8 +843,10 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "auth/v1/method/token" - urlBuilder_.Append("auth/v1/method/token"); + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags"); PrepareRequest(client_, request_, urlBuilder_); @@ -784,7 +873,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -812,9 +901,16 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task AuthV1TokensGetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsGetAsync(string namespaceKey, string flagKey, int? limit = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + var client_ = _httpClient; var disposeClient_ = false; try @@ -826,8 +922,26 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "auth/v1/tokens" - urlBuilder_.Append("auth/v1/tokens"); + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rollouts"); + urlBuilder_.Append('?'); + if (limit != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (pageToken != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("pageToken")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(pageToken, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (reference != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; PrepareRequest(client_, request_, urlBuilder_); @@ -854,7 +968,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -882,11 +996,18 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task AuthV1TokensGetAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsPostAsync(string namespaceKey, string flagKey, CreateRolloutRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (id == null) - throw new System.ArgumentNullException("id"); + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + if (body == null) + throw new System.ArgumentNullException("body"); var client_ = _httpClient; var disposeClient_ = false; @@ -894,14 +1015,21 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - request_.Method = new System.Net.Http.HttpMethod("GET"); + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "auth/v1/tokens/{id}" - urlBuilder_.Append("auth/v1/tokens/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rollouts"); PrepareRequest(client_, request_, urlBuilder_); @@ -928,7 +1056,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -956,25 +1084,39 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task AuthV1TokensDeleteAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsOrderAsync(string namespaceKey, string flagKey, OrderRolloutsRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (id == null) - throw new System.ArgumentNullException("id"); + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); - var client_ = _httpClient; - var disposeClient_ = false; - try + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - request_.Method = new System.Net.Http.HttpMethod("DELETE"); + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PUT"); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "auth/v1/tokens/{id}" - urlBuilder_.Append("auth/v1/tokens/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts/order" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rollouts/order"); PrepareRequest(client_, request_, urlBuilder_); @@ -999,7 +1141,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 204) + if (status_ == 200) { return; } @@ -1024,9 +1166,19 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task AuthV1SelfAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsGetAsync(string namespaceKey, string flagKey, string id, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + if (id == null) + throw new System.ArgumentNullException("id"); + var client_ = _httpClient; var disposeClient_ = false; try @@ -1038,8 +1190,19 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "auth/v1/self" - urlBuilder_.Append("auth/v1/self"); + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts/{id}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rollouts/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append('?'); + if (reference != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; PrepareRequest(client_, request_, urlBuilder_); @@ -1066,7 +1229,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -1094,9 +1257,19 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task AuthV1SelfExpireAsync(Body3 body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsPutAsync(string namespaceKey, string flagKey, string id, UpdateRolloutRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + if (id == null) + throw new System.ArgumentNullException("id"); + if (body == null) throw new System.ArgumentNullException("body"); @@ -1111,11 +1284,17 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; request_.Method = new System.Net.Http.HttpMethod("PUT"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "auth/v1/self/expire" - urlBuilder_.Append("auth/v1/self/expire"); + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts/{id}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rollouts/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); PrepareRequest(client_, request_, urlBuilder_); @@ -1140,9 +1319,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 204) + if (status_ == 200) { - return; + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; } else { @@ -1165,17 +1349,18 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsPostAsync(string namespaceKey, string segmentKey, ConstraintCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) throw new System.ArgumentNullException("namespaceKey"); - if (segmentKey == null) - throw new System.ArgumentNullException("segmentKey"); + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); - if (body == null) - throw new System.ArgumentNullException("body"); + if (id == null) + throw new System.ArgumentNullException("id"); var client_ = _httpClient; var disposeClient_ = false; @@ -1183,21 +1368,17 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + request_.Method = new System.Net.Http.HttpMethod("DELETE"); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/segments/{segmentKey}/constraints" + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts/{id}" urlBuilder_.Append("api/v1/namespaces/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/segments/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(segmentKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/constraints"); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rollouts/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); PrepareRequest(client_, request_, urlBuilder_); @@ -1224,12 +1405,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; + return; } else { @@ -1252,17 +1428,15 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsDeleteAsync(string namespaceKey, string segmentKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesGetAsync(string namespaceKey, string flagKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) throw new System.ArgumentNullException("namespaceKey"); - if (segmentKey == null) - throw new System.ArgumentNullException("segmentKey"); - - if (id == null) - throw new System.ArgumentNullException("id"); + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); var client_ = _httpClient; var disposeClient_ = false; @@ -1270,17 +1444,35 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - request_.Method = new System.Net.Http.HttpMethod("DELETE"); + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/segments/{segmentKey}/constraints/{id}" + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules" urlBuilder_.Append("api/v1/namespaces/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/segments/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(segmentKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/constraints/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rules"); + urlBuilder_.Append('?'); + if (limit != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (offset != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (pageToken != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("pageToken")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(pageToken, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (reference != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; PrepareRequest(client_, request_, urlBuilder_); @@ -1305,9 +1497,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 204) + if (status_ == 200) { - return; + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; } else { @@ -1330,17 +1527,15 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsPutAsync(string namespaceKey, string segmentKey, string id, ConstraintUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesPostAsync(string namespaceKey, string flagKey, CreateRuleRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) throw new System.ArgumentNullException("namespaceKey"); - if (segmentKey == null) - throw new System.ArgumentNullException("segmentKey"); - - if (id == null) - throw new System.ArgumentNullException("id"); + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); if (body == null) throw new System.ArgumentNullException("body"); @@ -1355,17 +1550,17 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var content_ = new System.Net.Http.ByteArrayContent(json_); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("PUT"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/segments/{segmentKey}/constraints/{id}" + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules" urlBuilder_.Append("api/v1/namespaces/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/segments/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(segmentKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/constraints/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rules"); PrepareRequest(client_, request_, urlBuilder_); @@ -1390,9 +1585,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 204) + if (status_ == 200) { - return; + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; } else { @@ -1415,8 +1615,9 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsPostAsync(string namespaceKey, string flagKey, string ruleId, DistributionCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesOrderAsync(string namespaceKey, string flagKey, OrderRulesRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) throw new System.ArgumentNullException("namespaceKey"); @@ -1424,9 +1625,6 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() if (flagKey == null) throw new System.ArgumentNullException("flagKey"); - if (ruleId == null) - throw new System.ArgumentNullException("ruleId"); - if (body == null) throw new System.ArgumentNullException("body"); @@ -1440,19 +1638,16 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var content_ = new System.Net.Http.ByteArrayContent(json_); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + request_.Method = new System.Net.Http.HttpMethod("PUT"); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{ruleId}/distributions" + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/order" urlBuilder_.Append("api/v1/namespaces/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Append("/flags/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rules/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(ruleId, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/distributions"); + urlBuilder_.Append("/rules/order"); PrepareRequest(client_, request_, urlBuilder_); @@ -1479,12 +1674,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; + return; } else { @@ -1507,8 +1697,9 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsDeleteAsync(string namespaceKey, string flagKey, string ruleId, string id, string variantId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesGetAsync(string namespaceKey, string flagKey, string id, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) throw new System.ArgumentNullException("namespaceKey"); @@ -1516,36 +1707,32 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() if (flagKey == null) throw new System.ArgumentNullException("flagKey"); - if (ruleId == null) - throw new System.ArgumentNullException("ruleId"); - if (id == null) throw new System.ArgumentNullException("id"); - if (variantId == null) - throw new System.ArgumentNullException("variantId"); - var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - request_.Method = new System.Net.Http.HttpMethod("DELETE"); + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{ruleId}/distributions/{id}" + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{id}" urlBuilder_.Append("api/v1/namespaces/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Append("/flags/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Append("/rules/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(ruleId, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/distributions/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Append('?'); - urlBuilder_.Append(System.Uri.EscapeDataString("variantId")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(variantId, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + if (reference != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } urlBuilder_.Length--; PrepareRequest(client_, request_, urlBuilder_); @@ -1571,9 +1758,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 204) + if (status_ == 200) { - return; + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; } else { @@ -1596,8 +1788,9 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsPutAsync(string namespaceKey, string flagKey, string ruleId, string id, DistributionUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesPutAsync(string namespaceKey, string flagKey, string id, UpdateRuleRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) throw new System.ArgumentNullException("namespaceKey"); @@ -1605,9 +1798,6 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() if (flagKey == null) throw new System.ArgumentNullException("flagKey"); - if (ruleId == null) - throw new System.ArgumentNullException("ruleId"); - if (id == null) throw new System.ArgumentNullException("id"); @@ -1629,14 +1819,12 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{ruleId}/distributions/{id}" + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{id}" urlBuilder_.Append("api/v1/namespaces/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Append("/flags/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Append("/rules/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(ruleId, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/distributions/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); PrepareRequest(client_, request_, urlBuilder_); @@ -1664,7 +1852,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -1692,14 +1880,18 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesEvaluateAsync(string namespaceKey, EvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) throw new System.ArgumentNullException("namespaceKey"); - if (body == null) - throw new System.ArgumentNullException("body"); + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + if (id == null) + throw new System.ArgumentNullException("id"); var client_ = _httpClient; var disposeClient_ = false; @@ -1707,21 +1899,19 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + request_.Method = new System.Net.Http.HttpMethod("DELETE"); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/evaluate" + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{id}" urlBuilder_.Append("api/v1/namespaces/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/evaluate"); - - PrepareRequest(client_, request_, urlBuilder_); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rules/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); @@ -1746,12 +1936,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; + return; } else { @@ -1774,12 +1959,19 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesBatchEvaluateAsync(string namespaceKey, BatchEvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsPostAsync(string namespaceKey, string flagKey, string ruleId, CreateDistributionRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) throw new System.ArgumentNullException("namespaceKey"); + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + if (ruleId == null) + throw new System.ArgumentNullException("ruleId"); + if (body == null) throw new System.ArgumentNullException("body"); @@ -1798,10 +1990,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/batch-evaluate" + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{ruleId}/distributions" urlBuilder_.Append("api/v1/namespaces/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/batch-evaluate"); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rules/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(ruleId, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/distributions"); PrepareRequest(client_, request_, urlBuilder_); @@ -1828,7 +2024,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -1856,45 +2052,49 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsGetAsync(string namespaceKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsPutAsync(string namespaceKey, string flagKey, string ruleId, string id, UpdateDistributionRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) throw new System.ArgumentNullException("namespaceKey"); + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + if (ruleId == null) + throw new System.ArgumentNullException("ruleId"); + + if (id == null) + throw new System.ArgumentNullException("id"); + + if (body == null) + throw new System.ArgumentNullException("body"); + var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - request_.Method = new System.Net.Http.HttpMethod("GET"); + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PUT"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags" + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{ruleId}/distributions/{id}" urlBuilder_.Append("api/v1/namespaces/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags"); - urlBuilder_.Append('?'); - if (limit != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (offset != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (pageToken != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("pageToken")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(pageToken, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (reference != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rules/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(ruleId, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/distributions/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); PrepareRequest(client_, request_, urlBuilder_); @@ -1921,7 +2121,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -1949,14 +2149,21 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsPostAsync(string namespaceKey, FlagCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsDeleteAsync(string namespaceKey, string flagKey, string ruleId, string id, string variantId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) throw new System.ArgumentNullException("namespaceKey"); - if (body == null) - throw new System.ArgumentNullException("body"); + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + if (ruleId == null) + throw new System.ArgumentNullException("ruleId"); + + if (id == null) + throw new System.ArgumentNullException("id"); var client_ = _httpClient; var disposeClient_ = false; @@ -1964,19 +2171,25 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + request_.Method = new System.Net.Http.HttpMethod("DELETE"); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags" + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{ruleId}/distributions/{id}" urlBuilder_.Append("api/v1/namespaces/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags"); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/rules/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(ruleId, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/distributions/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append('?'); + if (variantId != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("variantId")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(variantId, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; PrepareRequest(client_, request_, urlBuilder_); @@ -2003,12 +2216,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; + return; } else { @@ -2031,14 +2239,18 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsGetAsync(string namespaceKey, string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsPostAsync(string namespaceKey, string flagKey, CreateVariantRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) throw new System.ArgumentNullException("namespaceKey"); - if (key == null) - throw new System.ArgumentNullException("key"); + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + if (body == null) + throw new System.ArgumentNullException("body"); var client_ = _httpClient; var disposeClient_ = false; @@ -2046,22 +2258,21 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - request_.Method = new System.Net.Http.HttpMethod("GET"); + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{key}" + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/variants" urlBuilder_.Append("api/v1/namespaces/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append('?'); - if (reference != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/variants"); PrepareRequest(client_, request_, urlBuilder_); @@ -2088,7 +2299,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -2116,14 +2327,21 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsDeleteAsync(string namespaceKey, string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsPutAsync(string namespaceKey, string flagKey, string id, UpdateVariantRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) throw new System.ArgumentNullException("namespaceKey"); - if (key == null) - throw new System.ArgumentNullException("key"); + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); + + if (id == null) + throw new System.ArgumentNullException("id"); + + if (body == null) + throw new System.ArgumentNullException("body"); var client_ = _httpClient; var disposeClient_ = false; @@ -2131,15 +2349,22 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - request_.Method = new System.Net.Http.HttpMethod("DELETE"); + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PUT"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{key}" + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/variants/{id}" urlBuilder_.Append("api/v1/namespaces/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/variants/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); PrepareRequest(client_, request_, urlBuilder_); @@ -2164,9 +2389,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 204) + if (status_ == 200) { - return; + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; } else { @@ -2189,17 +2419,18 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsPutAsync(string namespaceKey, string key, FlagUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) throw new System.ArgumentNullException("namespaceKey"); - if (key == null) - throw new System.ArgumentNullException("key"); + if (flagKey == null) + throw new System.ArgumentNullException("flagKey"); - if (body == null) - throw new System.ArgumentNullException("body"); + if (id == null) + throw new System.ArgumentNullException("id"); var client_ = _httpClient; var disposeClient_ = false; @@ -2207,20 +2438,17 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("PUT"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + request_.Method = new System.Net.Http.HttpMethod("DELETE"); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{key}" + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/variants/{id}" urlBuilder_.Append("api/v1/namespaces/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/variants/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); PrepareRequest(client_, request_, urlBuilder_); @@ -2247,12 +2475,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; + return; } else { @@ -2275,9 +2498,16 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesGetAsync(int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsGetAsync(string namespaceKey, string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (key == null) + throw new System.ArgumentNullException("key"); + var client_ = _httpClient; var disposeClient_ = false; try @@ -2289,21 +2519,12 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces" - urlBuilder_.Append("api/v1/namespaces"); + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{key}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Append('?'); - if (limit != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (offset != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (pageToken != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("pageToken")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(pageToken, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } if (reference != null) { urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); @@ -2335,7 +2556,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -2363,9 +2584,16 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesPostAsync(NamespaceCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsPutAsync(string namespaceKey, string key, UpdateFlagRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + + if (key == null) + throw new System.ArgumentNullException("key"); + if (body == null) throw new System.ArgumentNullException("body"); @@ -2379,13 +2607,16 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var content_ = new System.Net.Http.ByteArrayContent(json_); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Method = new System.Net.Http.HttpMethod("PUT"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces" - urlBuilder_.Append("api/v1/namespaces"); + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{key}" + urlBuilder_.Append("api/v1/namespaces/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); PrepareRequest(client_, request_, urlBuilder_); @@ -2412,7 +2643,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -2440,9 +2671,13 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesGetAsync(string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsDeleteAsync(string namespaceKey, string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); + if (key == null) throw new System.ArgumentNullException("key"); @@ -2452,20 +2687,15 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + request_.Method = new System.Net.Http.HttpMethod("DELETE"); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{key}" + // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{key}" urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append('?'); - if (reference != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); PrepareRequest(client_, request_, urlBuilder_); @@ -2492,12 +2722,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; + return; } else { @@ -2520,11 +2745,12 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesDeleteAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsGetAsync(string namespaceKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (key == null) - throw new System.ArgumentNullException("key"); + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); var client_ = _httpClient; var disposeClient_ = false; @@ -2532,13 +2758,33 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - request_.Method = new System.Net.Http.HttpMethod("DELETE"); + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{key}" + // Operation Path: "api/v1/namespaces/{namespaceKey}/segments" urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/segments"); + urlBuilder_.Append('?'); + if (limit != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (offset != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (pageToken != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("pageToken")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(pageToken, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (reference != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; PrepareRequest(client_, request_, urlBuilder_); @@ -2563,9 +2809,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 204) + if (status_ == 200) { - return; + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; } else { @@ -2588,11 +2839,12 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesPutAsync(string key, NamespaceUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsPostAsync(string namespaceKey, CreateSegmentRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (key == null) - throw new System.ArgumentNullException("key"); + if (namespaceKey == null) + throw new System.ArgumentNullException("namespaceKey"); if (body == null) throw new System.ArgumentNullException("body"); @@ -2607,14 +2859,15 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var content_ = new System.Net.Http.ByteArrayContent(json_); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("PUT"); + request_.Method = new System.Net.Http.HttpMethod("POST"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{key}" + // Operation Path: "api/v1/namespaces/{namespaceKey}/segments" urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/segments"); PrepareRequest(client_, request_, urlBuilder_); @@ -2641,7 +2894,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -2669,14 +2922,15 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsGetAsync(string namespaceKey, string flagKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsGetAsync(string namespaceKey, string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) throw new System.ArgumentNullException("namespaceKey"); - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); + if (key == null) + throw new System.ArgumentNullException("key"); var client_ = _httpClient; var disposeClient_ = false; @@ -2689,25 +2943,12 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts" + // Operation Path: "api/v1/namespaces/{namespaceKey}/segments/{key}" urlBuilder_.Append("api/v1/namespaces/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rollouts"); + urlBuilder_.Append("/segments/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Append('?'); - if (limit != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (offset != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (pageToken != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("pageToken")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(pageToken, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } if (reference != null) { urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); @@ -2739,7 +2980,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -2767,14 +3008,15 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsPostAsync(string namespaceKey, string flagKey, RolloutCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsPutAsync(string namespaceKey, string key, UpdateSegmentRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) throw new System.ArgumentNullException("namespaceKey"); - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); + if (key == null) + throw new System.ArgumentNullException("key"); if (body == null) throw new System.ArgumentNullException("body"); @@ -2789,17 +3031,16 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var content_ = new System.Net.Http.ByteArrayContent(json_); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Method = new System.Net.Http.HttpMethod("PUT"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts" + // Operation Path: "api/v1/namespaces/{namespaceKey}/segments/{key}" urlBuilder_.Append("api/v1/namespaces/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rollouts"); + urlBuilder_.Append("/segments/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); PrepareRequest(client_, request_, urlBuilder_); @@ -2826,7 +3067,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -2854,17 +3095,15 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsOrderAsync(string namespaceKey, string flagKey, RolloutOrderRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsDeleteAsync(string namespaceKey, string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) throw new System.ArgumentNullException("namespaceKey"); - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); - - if (body == null) - throw new System.ArgumentNullException("body"); + if (key == null) + throw new System.ArgumentNullException("key"); var client_ = _httpClient; var disposeClient_ = false; @@ -2872,20 +3111,15 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("PUT"); + request_.Method = new System.Net.Http.HttpMethod("DELETE"); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts/order" + // Operation Path: "api/v1/namespaces/{namespaceKey}/segments/{key}" urlBuilder_.Append("api/v1/namespaces/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rollouts/order"); + urlBuilder_.Append("/segments/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); PrepareRequest(client_, request_, urlBuilder_); @@ -2910,7 +3144,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 204) + if (status_ == 200) { return; } @@ -2935,17 +3169,18 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsGetAsync(string namespaceKey, string flagKey, string id, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsPostAsync(string namespaceKey, string segmentKey, CreateConstraintRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) throw new System.ArgumentNullException("namespaceKey"); - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); + if (segmentKey == null) + throw new System.ArgumentNullException("segmentKey"); - if (id == null) - throw new System.ArgumentNullException("id"); + if (body == null) + throw new System.ArgumentNullException("body"); var client_ = _httpClient; var disposeClient_ = false; @@ -2953,24 +3188,21 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - request_.Method = new System.Net.Http.HttpMethod("GET"); + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts/{id}" + // Operation Path: "api/v1/namespaces/{namespaceKey}/segments/{segmentKey}/constraints" urlBuilder_.Append("api/v1/namespaces/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rollouts/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append('?'); - if (reference != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; + urlBuilder_.Append("/segments/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(segmentKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/constraints"); PrepareRequest(client_, request_, urlBuilder_); @@ -2997,7 +3229,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -3025,34 +3257,43 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsPutAsync(string namespaceKey, string segmentKey, string id, UpdateConstraintRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) throw new System.ArgumentNullException("namespaceKey"); - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); + if (segmentKey == null) + throw new System.ArgumentNullException("segmentKey"); if (id == null) throw new System.ArgumentNullException("id"); + if (body == null) + throw new System.ArgumentNullException("body"); + var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - request_.Method = new System.Net.Http.HttpMethod("DELETE"); + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PUT"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts/{id}" + // Operation Path: "api/v1/namespaces/{namespaceKey}/segments/{segmentKey}/constraints/{id}" urlBuilder_.Append("api/v1/namespaces/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rollouts/"); + urlBuilder_.Append("/segments/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(segmentKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/constraints/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); PrepareRequest(client_, request_, urlBuilder_); @@ -3078,9 +3319,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 204) + if (status_ == 200) { - return; + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; } else { @@ -3103,41 +3349,35 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsPutAsync(string namespaceKey, string flagKey, string id, RolloutUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsDeleteAsync(string namespaceKey, string segmentKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (namespaceKey == null) throw new System.ArgumentNullException("namespaceKey"); - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); + if (segmentKey == null) + throw new System.ArgumentNullException("segmentKey"); if (id == null) throw new System.ArgumentNullException("id"); - if (body == null) - throw new System.ArgumentNullException("body"); - var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("PUT"); + request_.Method = new System.Net.Http.HttpMethod("DELETE"); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts/{id}" + // Operation Path: "api/v1/namespaces/{namespaceKey}/segments/{segmentKey}/constraints/{id}" urlBuilder_.Append("api/v1/namespaces/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rollouts/"); + urlBuilder_.Append("/segments/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(segmentKey, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/constraints/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); PrepareRequest(client_, request_, urlBuilder_); @@ -3163,7 +3403,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 204) + if (status_ == 200) { return; } @@ -3188,14 +3428,12 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesGetAsync(string namespaceKey, string flagKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task AuthV1MethodKubernetesServiceaccountAsync(VerifyServiceAccountRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); + if (body == null) + throw new System.ArgumentNullException("body"); var client_ = _httpClient; var disposeClient_ = false; @@ -3203,46 +3441,28 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - request_.Method = new System.Net.Http.HttpMethod("GET"); + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rules"); - urlBuilder_.Append('?'); - if (limit != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (offset != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (pageToken != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("pageToken")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(pageToken, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (reference != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try + // Operation Path: "auth/v1/method/kubernetes/serviceaccount" + urlBuilder_.Append("auth/v1/method/kubernetes/serviceaccount"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try { var headers_ = new System.Collections.Generic.Dictionary>(); foreach (var item_ in response_.Headers) @@ -3258,7 +3478,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -3286,17 +3506,12 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesPostAsync(string namespaceKey, string flagKey, RuleCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task AuthV1MethodOidcAuthorizeAsync(string provider, string state = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); - - if (body == null) - throw new System.ArgumentNullException("body"); + if (provider == null) + throw new System.ArgumentNullException("provider"); var client_ = _httpClient; var disposeClient_ = false; @@ -3304,21 +3519,21 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Method = new System.Net.Http.HttpMethod("GET"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rules"); + // Operation Path: "auth/v1/method/oidc/{provider}/authorize" + urlBuilder_.Append("auth/v1/method/oidc/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(provider, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/authorize"); + urlBuilder_.Append('?'); + if (state != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("state")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(state, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; PrepareRequest(client_, request_, urlBuilder_); @@ -3345,7 +3560,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -3373,17 +3588,12 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesOrderAsync(string namespaceKey, string flagKey, RuleOrderRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task AuthV1MethodOidcCallbackAsync(string provider, string code = null, string state = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); - - if (body == null) - throw new System.ArgumentNullException("body"); + if (provider == null) + throw new System.ArgumentNullException("provider"); var client_ = _httpClient; var disposeClient_ = false; @@ -3391,20 +3601,25 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("PUT"); + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/order" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rules/order"); + // Operation Path: "auth/v1/method/oidc/{provider}/callback" + urlBuilder_.Append("auth/v1/method/oidc/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(provider, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/callback"); + urlBuilder_.Append('?'); + if (code != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("code")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(code, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (state != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("state")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(state, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; PrepareRequest(client_, request_, urlBuilder_); @@ -3429,9 +3644,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 204) + if (status_ == 200) { - return; + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; } else { @@ -3454,17 +3674,12 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesGetAsync(string namespaceKey, string flagKey, string id, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task AuthV1MethodTokenAsync(CreateTokenRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); - - if (id == null) - throw new System.ArgumentNullException("id"); + if (body == null) + throw new System.ArgumentNullException("body"); var client_ = _httpClient; var disposeClient_ = false; @@ -3472,24 +3687,17 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - request_.Method = new System.Net.Http.HttpMethod("GET"); + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{id}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rules/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append('?'); - if (reference != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; + // Operation Path: "auth/v1/method/token" + urlBuilder_.Append("auth/v1/method/token"); PrepareRequest(client_, request_, urlBuilder_); @@ -3516,7 +3724,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -3544,35 +3752,23 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task AuthV1SelfAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); - - if (id == null) - throw new System.ArgumentNullException("id"); - var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - request_.Method = new System.Net.Http.HttpMethod("DELETE"); + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{id}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rules/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + // Operation Path: "auth/v1/self" + urlBuilder_.Append("auth/v1/self"); PrepareRequest(client_, request_, urlBuilder_); @@ -3597,9 +3793,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 204) + if (status_ == 200) { - return; + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; } else { @@ -3622,42 +3823,29 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesPutAsync(string namespaceKey, string flagKey, string id, RuleUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task AuthV1SelfExpireAsync(System.DateTimeOffset? expiresAt = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); - - if (id == null) - throw new System.ArgumentNullException("id"); - - if (body == null) - throw new System.ArgumentNullException("body"); - var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); request_.Method = new System.Net.Http.HttpMethod("PUT"); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{id}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rules/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + // Operation Path: "auth/v1/self/expire" + urlBuilder_.Append("auth/v1/self/expire"); + urlBuilder_.Append('?'); + if (expiresAt != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("expiresAt")).Append('=').Append(System.Uri.EscapeDataString(expiresAt.Value.ToString("s", System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; PrepareRequest(client_, request_, urlBuilder_); @@ -3682,7 +3870,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 204) + if (status_ == 200) { return; } @@ -3707,12 +3895,10 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsGetAsync(string namespaceKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task AuthV1TokensGetAsync(Method? method = null, int? limit = null, string pageToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - var client_ = _httpClient; var disposeClient_ = false; try @@ -3724,27 +3910,21 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/segments" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/segments"); + // Operation Path: "auth/v1/tokens" + urlBuilder_.Append("auth/v1/tokens"); urlBuilder_.Append('?'); - if (limit != null) + if (method != null) { - urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + urlBuilder_.Append(System.Uri.EscapeDataString("method")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(method, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); } - if (offset != null) + if (limit != null) { - urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); } if (pageToken != null) { urlBuilder_.Append(System.Uri.EscapeDataString("pageToken")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(pageToken, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); } - if (reference != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } urlBuilder_.Length--; PrepareRequest(client_, request_, urlBuilder_); @@ -3772,7 +3952,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -3800,14 +3980,12 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsPostAsync(string namespaceKey, SegmentCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task AuthV1TokensGetAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (body == null) - throw new System.ArgumentNullException("body"); + if (id == null) + throw new System.ArgumentNullException("id"); var client_ = _httpClient; var disposeClient_ = false; @@ -3815,19 +3993,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Method = new System.Net.Http.HttpMethod("GET"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/segments" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/segments"); + // Operation Path: "auth/v1/tokens/{id}" + urlBuilder_.Append("auth/v1/tokens/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); PrepareRequest(client_, request_, urlBuilder_); @@ -3854,7 +4027,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -3882,14 +4055,12 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsGetAsync(string namespaceKey, string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task AuthV1TokensDeleteAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (key == null) - throw new System.ArgumentNullException("key"); + if (id == null) + throw new System.ArgumentNullException("id"); var client_ = _httpClient; var disposeClient_ = false; @@ -3897,22 +4068,13 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + request_.Method = new System.Net.Http.HttpMethod("DELETE"); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/segments/{key}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/segments/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append('?'); - if (reference != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; + // Operation Path: "auth/v1/tokens/{id}" + urlBuilder_.Append("auth/v1/tokens/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); PrepareRequest(client_, request_, urlBuilder_); @@ -3939,12 +4101,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; + return; } else { @@ -3967,14 +4124,12 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsDeleteAsync(string namespaceKey, string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task EvaluateV1BatchAsync(BatchEvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (key == null) - throw new System.ArgumentNullException("key"); + if (body == null) + throw new System.ArgumentNullException("body"); var client_ = _httpClient; var disposeClient_ = false; @@ -3982,15 +4137,17 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - request_.Method = new System.Net.Http.HttpMethod("DELETE"); + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/segments/{key}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/segments/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); + // Operation Path: "evaluate/v1/batch" + urlBuilder_.Append("evaluate/v1/batch"); PrepareRequest(client_, request_, urlBuilder_); @@ -4015,9 +4172,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 204) + if (status_ == 200) { - return; + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; } else { @@ -4040,15 +4202,10 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsPutAsync(string namespaceKey, string key, SegmentUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task EvaluateV1BooleanAsync(EvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (key == null) - throw new System.ArgumentNullException("key"); - if (body == null) throw new System.ArgumentNullException("body"); @@ -4062,16 +4219,13 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var content_ = new System.Net.Http.ByteArrayContent(json_); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("PUT"); + request_.Method = new System.Net.Http.HttpMethod("POST"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/segments/{key}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/segments/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); + // Operation Path: "evaluate/v1/boolean" + urlBuilder_.Append("evaluate/v1/boolean"); PrepareRequest(client_, request_, urlBuilder_); @@ -4098,7 +4252,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -4126,15 +4280,10 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsPostAsync(string namespaceKey, string flagKey, VariantCreateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task EvaluateV1VariantAsync(EvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); - if (body == null) throw new System.ArgumentNullException("body"); @@ -4153,12 +4302,8 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/variants" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/variants"); + // Operation Path: "evaluate/v1/variant" + urlBuilder_.Append("evaluate/v1/variant"); PrepareRequest(client_, request_, urlBuilder_); @@ -4185,7 +4330,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -4213,17 +4358,89 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// OFREP provider configuration + /// + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task OfrepV1ConfigurationAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "ofrep/v1/configuration" + urlBuilder_.Append("ofrep/v1/configuration"); - if (id == null) - throw new System.ArgumentNullException("id"); + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// OFREP bulk flag evaluation + /// + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task OfrepV1EvaluateFlagsPostAsync(EvaluateBulkRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (body == null) + throw new System.ArgumentNullException("body"); var client_ = _httpClient; var disposeClient_ = false; @@ -4231,17 +4448,17 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - request_.Method = new System.Net.Http.HttpMethod("DELETE"); + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/variants/{id}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/variants/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + // Operation Path: "ofrep/v1/evaluate/flags" + urlBuilder_.Append("ofrep/v1/evaluate/flags"); PrepareRequest(client_, request_, urlBuilder_); @@ -4266,9 +4483,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 204) + if (status_ == 200) { - return; + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; } else { @@ -4291,17 +4513,15 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// OFREP single flag evaluation + /// + /// OK /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsPutAsync(string namespaceKey, string flagKey, string id, VariantUpdateRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task OfrepV1EvaluateFlagsPostAsync(string key, EvaluateFlagRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); - - if (id == null) - throw new System.ArgumentNullException("id"); + if (key == null) + throw new System.ArgumentNullException("key"); if (body == null) throw new System.ArgumentNullException("body"); @@ -4316,18 +4536,14 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var content_ = new System.Net.Http.ByteArrayContent(json_); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("PUT"); + request_.Method = new System.Net.Http.HttpMethod("POST"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); var urlBuilder_ = new System.Text.StringBuilder(); - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/variants/{id}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/variants/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + // Operation Path: "ofrep/v1/evaluate/flags/{key}" + urlBuilder_.Append("ofrep/v1/evaluate/flags/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); PrepareRequest(client_, request_, urlBuilder_); @@ -4354,7 +4570,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -4491,30 +4707,27 @@ private string ConvertToString(object value, System.Globalization.CultureInfo cu } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record EvaluationRequest + public partial record Authentication { - [System.Text.Json.Serialization.JsonPropertyName("requestId")] - public string RequestId { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("id")] + public string Id { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string NamespaceKey { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("method")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public AuthenticationMethod Method { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("flagKey")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string FlagKey { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("expiresAt")] + public System.DateTimeOffset ExpiresAt { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("entityId")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string EntityId { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("createdAt")] + public System.DateTimeOffset CreatedAt { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("context")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.IDictionary Context { get; set; } = new System.Collections.Generic.Dictionary(); + [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] + public System.DateTimeOffset UpdatedAt { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("reference")] - public string Reference { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("metadata")] + public System.Collections.Generic.IDictionary Metadata { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -4528,37 +4741,11 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum EvaluationResponseType - { - - [System.Runtime.Serialization.EnumMember(Value = @"VARIANT_EVALUATION_RESPONSE_TYPE")] - VARIANT_EVALUATION_RESPONSE_TYPE = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"BOOLEAN_EVALUATION_RESPONSE_TYPE")] - BOOLEAN_EVALUATION_RESPONSE_TYPE = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"ERROR_EVALUATION_RESPONSE_TYPE")] - ERROR_EVALUATION_RESPONSE_TYPE = 2, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record EvaluationResponse + public partial record AuthorizeURLResponse { - [System.Text.Json.Serialization.JsonPropertyName("type")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public EvaluationResponseType Type { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("booleanResponse")] - public BooleanEvaluationResponse BooleanResponse { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("variantResponse")] - public VariantEvaluationResponse VariantResponse { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("errorResponse")] - public ErrorEvaluationResponse ErrorResponse { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("authorizeUrl")] + public string AuthorizeUrl { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -4572,21 +4759,18 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record ErrorEvaluationResponse + public partial record BatchEvaluationRequest { - [System.Text.Json.Serialization.JsonPropertyName("flagKey")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string FlagKey { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("requestId")] + public string RequestId { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string NamespaceKey { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("requests")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Requests { get; set; } = new System.Collections.ObjectModel.Collection(); - [System.Text.Json.Serialization.JsonPropertyName("reason")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public ErrorEvaluationReason Reason { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("reference")] + public string Reference { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -4600,32 +4784,18 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record BooleanEvaluationResponse + public partial record BatchEvaluationResponse { [System.Text.Json.Serialization.JsonPropertyName("requestId")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string RequestId { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("flagKey")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string FlagKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("enabled")] - public bool Enabled { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("timestamp")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public System.DateTimeOffset Timestamp { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("responses")] + public System.Collections.Generic.ICollection Responses { get; set; } [System.Text.Json.Serialization.JsonPropertyName("requestDurationMillis")] public double RequestDurationMillis { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("reason")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public EvaluationReason Reason { get; set; } - private System.Collections.Generic.IDictionary _additionalProperties; [System.Text.Json.Serialization.JsonExtensionData] @@ -4638,43 +4808,27 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record VariantEvaluationResponse + public partial record BooleanEvaluationResponse { - [System.Text.Json.Serialization.JsonPropertyName("requestId")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string RequestId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("match")] - public bool Match { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("flagKey")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string FlagKey { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("enabled")] + public bool Enabled { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("segmentKeys")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection SegmentKeys { get; set; } = new System.Collections.ObjectModel.Collection(); + [System.Text.Json.Serialization.JsonPropertyName("reason")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public BooleanEvaluationResponseReason Reason { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("variantKey")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string VariantKey { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("requestId")] + public string RequestId { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("variantAttachment")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string VariantAttachment { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("requestDurationMillis")] + public double RequestDurationMillis { get; set; } [System.Text.Json.Serialization.JsonPropertyName("timestamp")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public System.DateTimeOffset Timestamp { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("requestDurationMillis")] - public double RequestDurationMillis { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("reason")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public EvaluationReason Reason { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("flagKey")] + public string FlagKey { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -4688,48 +4842,12 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum EvaluationReason - { - - [System.Runtime.Serialization.EnumMember(Value = @"UNKNOWN_EVALUATION_REASON")] - UNKNOWN_EVALUATION_REASON = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"FLAG_DISABLED_EVALUATION_REASON")] - FLAG_DISABLED_EVALUATION_REASON = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"MATCH_EVALUATION_REASON")] - MATCH_EVALUATION_REASON = 2, - - [System.Runtime.Serialization.EnumMember(Value = @"DEFAULT_EVALUATION_REASON")] - DEFAULT_EVALUATION_REASON = 3, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum ErrorEvaluationReason - { - - [System.Runtime.Serialization.EnumMember(Value = @"UNKNOWN_ERROR_EVALUATION_REASON")] - UNKNOWN_ERROR_EVALUATION_REASON = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"NOT_FOUND_ERROR_EVALUATION_REASON")] - NOT_FOUND_ERROR_EVALUATION_REASON = 1, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record BatchEvaluationRequest + public partial record BulkEvaluationResponse { - [System.Text.Json.Serialization.JsonPropertyName("requestId")] - public string RequestId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("requests")] + [System.Text.Json.Serialization.JsonPropertyName("flags")] [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Requests { get; set; } = new System.Collections.ObjectModel.Collection(); - - [System.Text.Json.Serialization.JsonPropertyName("reference")] - public string Reference { get; set; } + public System.Collections.Generic.ICollection Flags { get; set; } = new System.Collections.ObjectModel.Collection(); private System.Collections.Generic.IDictionary _additionalProperties; @@ -4743,19 +4861,11 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record BatchEvaluationResponse + public partial record CacheInvalidation { - [System.Text.Json.Serialization.JsonPropertyName("requestId")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string RequestId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("responses")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Responses { get; set; } = new System.Collections.ObjectModel.Collection(); - - [System.Text.Json.Serialization.JsonPropertyName("requestDurationMillis")] - public double RequestDurationMillis { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("polling")] + public Polling Polling { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -4769,12 +4879,14 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record AuthMethodOIDCAuthorizeURLResponse + public partial record CallbackResponse { - [System.Text.Json.Serialization.JsonPropertyName("authorizeUrl")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string AuthorizeUrl { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("clientToken")] + public string ClientToken { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("authentication")] + public Authentication Authentication { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -4788,12 +4900,14 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record AuthMethodOIDCCallbackResponse + public partial record Capabilities { - [System.Text.Json.Serialization.JsonPropertyName("authentication")] - [System.ComponentModel.DataAnnotations.Required] - public Authentication Authentication { get; set; } = new Authentication(); + [System.Text.Json.Serialization.JsonPropertyName("cacheInvalidation")] + public CacheInvalidation CacheInvalidation { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("flagEvaluation")] + public FlagEvaluation FlagEvaluation { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -4806,57 +4920,80 @@ public System.Collections.Generic.IDictionary AdditionalProperti } - /// - /// The default is METHOD_NONE - /// [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum AuthenticationMethod + public partial record Constraint { - [System.Runtime.Serialization.EnumMember(Value = @"METHOD_NONE")] - METHOD_NONE = 0, + [System.Text.Json.Serialization.JsonPropertyName("id")] + public string Id { get; set; } - [System.Runtime.Serialization.EnumMember(Value = @"METHOD_TOKEN")] - METHOD_TOKEN = 1, + [System.Text.Json.Serialization.JsonPropertyName("segmentKey")] + public string SegmentKey { get; set; } - [System.Runtime.Serialization.EnumMember(Value = @"METHOD_OIDC")] - METHOD_OIDC = 2, + [System.Text.Json.Serialization.JsonPropertyName("type")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public ConstraintType Type { get; set; } - [System.Runtime.Serialization.EnumMember(Value = @"METHOD_KUBERNETES")] - METHOD_KUBERNETES = 3, + [System.Text.Json.Serialization.JsonPropertyName("property")] + public string Property { get; set; } - [System.Runtime.Serialization.EnumMember(Value = @"METHOD_JWT")] - METHOD_JWT = 4, + [System.Text.Json.Serialization.JsonPropertyName("operator")] + public string Operator { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("value")] + public string Value { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("createdAt")] + public System.DateTimeOffset CreatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] + public System.DateTimeOffset UpdatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + public string NamespaceKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("description")] + public string Description { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record Authentication + public partial record CreateConstraintRequest { - [System.Text.Json.Serialization.JsonPropertyName("id")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Id { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("segmentKey")] + public string SegmentKey { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("method")] + [System.Text.Json.Serialization.JsonPropertyName("type")] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public AuthenticationMethod Method { get; set; } + public CreateConstraintRequestType Type { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("createdAt")] + [System.Text.Json.Serialization.JsonPropertyName("property")] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public System.DateTimeOffset CreatedAt { get; set; } + public string Property { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] + [System.Text.Json.Serialization.JsonPropertyName("operator")] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public System.DateTimeOffset UpdatedAt { get; set; } + public string Operator { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("expiresAt")] - public System.DateTimeOffset ExpiresAt { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("value")] + public string Value { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("metadata")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.IDictionary Metadata { get; set; } = new System.Collections.Generic.Dictionary(); + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + public string NamespaceKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("description")] + public string Description { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -4870,16 +5007,24 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record AuthenticationList + public partial record CreateDistributionRequest { - [System.Text.Json.Serialization.JsonPropertyName("authentications")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Authentications { get; set; } = new System.Collections.ObjectModel.Collection(); + [System.Text.Json.Serialization.JsonPropertyName("flagKey")] + public string FlagKey { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("nextPageToken")] + [System.Text.Json.Serialization.JsonPropertyName("ruleId")] + public string RuleId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("variantId")] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string NextPageToken { get; set; } + public string VariantId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("rollout")] + public float Rollout { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + public string NamespaceKey { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -4893,16 +5038,33 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record AuthenticationToken + public partial record CreateFlagRequest { - [System.Text.Json.Serialization.JsonPropertyName("clientToken")] + [System.Text.Json.Serialization.JsonPropertyName("key")] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string ClientToken { get; set; } + public string Key { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("authentication")] - [System.ComponentModel.DataAnnotations.Required] - public Authentication Authentication { get; set; } = new Authentication(); + [System.Text.Json.Serialization.JsonPropertyName("name")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("description")] + public string Description { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("enabled")] + public bool Enabled { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + public string NamespaceKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("type")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public CreateFlagRequestType Type { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("metadata")] + public object Metadata { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -4916,14 +5078,19 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record CommonsPageable + public partial record CreateNamespaceRequest { - [System.Text.Json.Serialization.JsonPropertyName("nextPageToken")] - public string NextPageToken { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("key")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Key { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("totalCount")] - public int TotalCount { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("name")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("description")] + public string Description { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -4936,74 +5103,95 @@ public System.Collections.Generic.IDictionary AdditionalProperti } - /// - /// The default is UNKNOWN_COMPARISON_TYPE - /// [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum ConstraintComparisonType + public partial record CreateRolloutRequest { - [System.Runtime.Serialization.EnumMember(Value = @"UNKNOWN_COMPARISON_TYPE")] - UNKNOWN_COMPARISON_TYPE = 0, + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + public string NamespaceKey { get; set; } - [System.Runtime.Serialization.EnumMember(Value = @"STRING_COMPARISON_TYPE")] - STRING_COMPARISON_TYPE = 1, + [System.Text.Json.Serialization.JsonPropertyName("flagKey")] + public string FlagKey { get; set; } - [System.Runtime.Serialization.EnumMember(Value = @"NUMBER_COMPARISON_TYPE")] - NUMBER_COMPARISON_TYPE = 2, + [System.Text.Json.Serialization.JsonPropertyName("rank")] + public int Rank { get; set; } - [System.Runtime.Serialization.EnumMember(Value = @"BOOLEAN_COMPARISON_TYPE")] - BOOLEAN_COMPARISON_TYPE = 3, + [System.Text.Json.Serialization.JsonPropertyName("description")] + public string Description { get; set; } - [System.Runtime.Serialization.EnumMember(Value = @"DATETIME_COMPARISON_TYPE")] - DATETIME_COMPARISON_TYPE = 4, + [System.Text.Json.Serialization.JsonPropertyName("segment")] + public RolloutSegment Segment { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("threshold")] + public RolloutThreshold Threshold { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record Constraint + public partial record CreateRuleRequest { - [System.Text.Json.Serialization.JsonPropertyName("id")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Id { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("flagKey")] + public string FlagKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("segmentKey")] + public string SegmentKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("rank")] + public int Rank { get; set; } [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string NamespaceKey { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("segmentKey")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string SegmentKey { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("segmentKeys")] + public System.Collections.Generic.ICollection SegmentKeys { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("type")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [System.Text.Json.Serialization.JsonPropertyName("segmentOperator")] [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public ConstraintComparisonType Type { get; set; } + public CreateRuleRequestSegmentOperator SegmentOperator { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("property")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Property { get; set; } + private System.Collections.Generic.IDictionary _additionalProperties; - [System.Text.Json.Serialization.JsonPropertyName("operator")] + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record CreateSegmentRequest + { + + [System.Text.Json.Serialization.JsonPropertyName("key")] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Operator { get; set; } + public string Key { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("value")] + [System.Text.Json.Serialization.JsonPropertyName("name")] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Value { get; set; } + public string Name { get; set; } [System.Text.Json.Serialization.JsonPropertyName("description")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Description { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("createdAt")] + [System.Text.Json.Serialization.JsonPropertyName("matchType")] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public System.DateTimeOffset CreatedAt { get; set; } + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public CreateSegmentRequestMatchType MatchType { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public System.DateTimeOffset UpdatedAt { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + public string NamespaceKey { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -5017,27 +5205,23 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record ConstraintCreateRequest + public partial record CreateTokenRequest { - [System.Text.Json.Serialization.JsonPropertyName("type")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public ConstraintComparisonType Type { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("property")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Property { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("description")] + public string Description { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("operator")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Operator { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("expiresAt")] + public System.DateTimeOffset ExpiresAt { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("value")] - public string Value { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + public string NamespaceKey { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("metadata")] + public System.Collections.Generic.IDictionary Metadata { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -5051,28 +5235,49 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record ConstraintUpdateRequest + public partial record CreateTokenResponse { - [System.Text.Json.Serialization.JsonPropertyName("type")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public ConstraintComparisonType Type { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("clientToken")] + public string ClientToken { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("property")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Property { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("authentication")] + public Authentication Authentication { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("operator")] + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record CreateVariantRequest + { + + [System.Text.Json.Serialization.JsonPropertyName("flagKey")] + public string FlagKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("key")] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Operator { get; set; } + public string Key { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("value")] - public string Value { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } [System.Text.Json.Serialization.JsonPropertyName("description")] public string Description { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("attachment")] + public string Attachment { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + public string NamespaceKey { get; set; } + private System.Collections.Generic.IDictionary _additionalProperties; [System.Text.Json.Serialization.JsonExtensionData] @@ -5089,26 +5294,21 @@ public partial record Distribution { [System.Text.Json.Serialization.JsonPropertyName("id")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Id { get; set; } [System.Text.Json.Serialization.JsonPropertyName("ruleId")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string RuleId { get; set; } [System.Text.Json.Serialization.JsonPropertyName("variantId")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string VariantId { get; set; } [System.Text.Json.Serialization.JsonPropertyName("rollout")] - public double Rollout { get; set; } + public float Rollout { get; set; } [System.Text.Json.Serialization.JsonPropertyName("createdAt")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public System.DateTimeOffset CreatedAt { get; set; } [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public System.DateTimeOffset UpdatedAt { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -5123,15 +5323,18 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record DistributionCreateRequest + public partial record ErrorEvaluationResponse { - [System.Text.Json.Serialization.JsonPropertyName("variantId")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string VariantId { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("flagKey")] + public string FlagKey { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("rollout")] - public double Rollout { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + public string NamespaceKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("reason")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public ErrorEvaluationResponseReason Reason { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -5145,15 +5348,11 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record DistributionUpdateRequest + public partial record EvaluateBulkRequest { - [System.Text.Json.Serialization.JsonPropertyName("variantId")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string VariantId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("rollout")] - public double Rollout { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("context")] + public System.Collections.Generic.IDictionary Context { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -5167,19 +5366,14 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record FlagList + public partial record EvaluateFlagRequest { - [System.Text.Json.Serialization.JsonPropertyName("flags")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Flags { get; set; } = new System.Collections.ObjectModel.Collection(); - - [System.Text.Json.Serialization.JsonPropertyName("nextPageToken")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string NextPageToken { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("key")] + public string Key { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("totalCount")] - public int TotalCount { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("context")] + public System.Collections.Generic.IDictionary Context { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -5193,47 +5387,24 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record Flag + public partial record EvaluatedFlag { - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string NamespaceKey { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("key")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Key { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("name")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("description")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Description { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("enabled")] - public bool Enabled { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("createdAt")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public System.DateTimeOffset CreatedAt { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public System.DateTimeOffset UpdatedAt { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("reason")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public EvaluatedFlagReason Reason { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("variants")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Variants { get; set; } = new System.Collections.ObjectModel.Collection(); + [System.Text.Json.Serialization.JsonPropertyName("variant")] + public string Variant { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("type")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public FlagType Type { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("metadata")] + public object Metadata { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("defaultVariant")] - public Variant DefaultVariant { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("value")] + public GoogleProtobufValue Value { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -5247,39 +5418,58 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum FlagType + public partial record EvaluationRequest { - [System.Runtime.Serialization.EnumMember(Value = @"VARIANT_FLAG_TYPE")] - VARIANT_FLAG_TYPE = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"BOOLEAN_FLAG_TYPE")] - BOOLEAN_FLAG_TYPE = 1, - - } + [System.Text.Json.Serialization.JsonPropertyName("requestId")] + public string RequestId { get; set; } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record FlagCreateRequest - { + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string NamespaceKey { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("key")] + [System.Text.Json.Serialization.JsonPropertyName("flagKey")] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Key { get; set; } + public string FlagKey { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("name")] + [System.Text.Json.Serialization.JsonPropertyName("entityId")] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Name { get; set; } + public string EntityId { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("context")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.IDictionary Context { get; set; } = new System.Collections.Generic.Dictionary(); - [System.Text.Json.Serialization.JsonPropertyName("enabled")] - public bool Enabled { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("reference")] + public string Reference { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("type")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record EvaluationResponse + { + + [System.Text.Json.Serialization.JsonPropertyName("type")] [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public FlagType Type { get; set; } + public EvaluationResponseType Type { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("booleanResponse")] + public BooleanEvaluationResponse BooleanResponse { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("variantResponse")] + public VariantEvaluationResponse VariantResponse { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("errorResponse")] + public ErrorEvaluationResponse ErrorResponse { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -5293,11 +5483,13 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record FlagUpdateRequest + public partial record Flag { + [System.Text.Json.Serialization.JsonPropertyName("key")] + public string Key { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("name")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Name { get; set; } [System.Text.Json.Serialization.JsonPropertyName("description")] @@ -5306,8 +5498,27 @@ public partial record FlagUpdateRequest [System.Text.Json.Serialization.JsonPropertyName("enabled")] public bool Enabled { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("defaultVariantId")] - public string DefaultVariantId { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("createdAt")] + public System.DateTimeOffset CreatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] + public System.DateTimeOffset UpdatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("variants")] + public System.Collections.Generic.ICollection Variants { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + public string NamespaceKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("type")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public FlagType Type { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("defaultVariant")] + public Variant DefaultVariant { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("metadata")] + public object Metadata { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -5321,15 +5532,31 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record NamespaceList + public partial record FlagEvaluation { - [System.Text.Json.Serialization.JsonPropertyName("namespaces")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Namespaces { get; set; } = new System.Collections.ObjectModel.Collection(); + [System.Text.Json.Serialization.JsonPropertyName("supportedTypes")] + public System.Collections.Generic.ICollection SupportedTypes { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record FlagList + { + + [System.Text.Json.Serialization.JsonPropertyName("flags")] + public System.Collections.Generic.ICollection Flags { get; set; } [System.Text.Json.Serialization.JsonPropertyName("nextPageToken")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string NextPageToken { get; set; } [System.Text.Json.Serialization.JsonPropertyName("totalCount")] @@ -5346,31 +5573,86 @@ public System.Collections.Generic.IDictionary AdditionalProperti } + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record GetProviderConfigurationResponse + { + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("capabilities")] + public Capabilities Capabilities { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record GoogleProtobufValue + { + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record ListAuthenticationsResponse + { + + [System.Text.Json.Serialization.JsonPropertyName("authentications")] + public System.Collections.Generic.ICollection Authentications { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("nextPageToken")] + public string NextPageToken { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] public partial record Namespace { [System.Text.Json.Serialization.JsonPropertyName("key")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Key { get; set; } [System.Text.Json.Serialization.JsonPropertyName("name")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Name { get; set; } [System.Text.Json.Serialization.JsonPropertyName("description")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Description { get; set; } [System.Text.Json.Serialization.JsonPropertyName("protected")] public bool Protected { get; set; } [System.Text.Json.Serialization.JsonPropertyName("createdAt")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public System.DateTimeOffset CreatedAt { get; set; } [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public System.DateTimeOffset UpdatedAt { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -5385,19 +5667,17 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record NamespaceCreateRequest + public partial record NamespaceList { - [System.Text.Json.Serialization.JsonPropertyName("key")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Key { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("namespaces")] + public System.Collections.Generic.ICollection Namespaces { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("name")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Name { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("nextPageToken")] + public string NextPageToken { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("totalCount")] + public int TotalCount { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -5411,15 +5691,18 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record NamespaceUpdateRequest + public partial record OrderRolloutsRequest { - [System.Text.Json.Serialization.JsonPropertyName("name")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Name { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("flagKey")] + public string FlagKey { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + public string NamespaceKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("rolloutIds")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection RolloutIds { get; set; } = new System.Collections.ObjectModel.Collection(); private System.Collections.Generic.IDictionary _additionalProperties; @@ -5433,19 +5716,39 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record RolloutList + public partial record OrderRulesRequest { - [System.Text.Json.Serialization.JsonPropertyName("rollouts")] + [System.Text.Json.Serialization.JsonPropertyName("flagKey")] + public string FlagKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("ruleIds")] [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Rollouts { get; set; } = new System.Collections.ObjectModel.Collection(); + public System.Collections.Generic.ICollection RuleIds { get; set; } = new System.Collections.ObjectModel.Collection(); - [System.Text.Json.Serialization.JsonPropertyName("nextPageToken")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string NextPageToken { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + public string NamespaceKey { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("totalCount")] - public int TotalCount { get; set; } + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record Polling + { + + [System.Text.Json.Serialization.JsonPropertyName("enabled")] + public bool Enabled { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("minPollingIntervalMs")] + public int MinPollingIntervalMs { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -5463,19 +5766,15 @@ public partial record Rollout { [System.Text.Json.Serialization.JsonPropertyName("id")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Id { get; set; } [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string NamespaceKey { get; set; } [System.Text.Json.Serialization.JsonPropertyName("flagKey")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string FlagKey { get; set; } [System.Text.Json.Serialization.JsonPropertyName("type")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] public RolloutType Type { get; set; } @@ -5483,15 +5782,12 @@ public partial record Rollout public int Rank { get; set; } [System.Text.Json.Serialization.JsonPropertyName("description")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Description { get; set; } [System.Text.Json.Serialization.JsonPropertyName("createdAt")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public System.DateTimeOffset CreatedAt { get; set; } [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public System.DateTimeOffset UpdatedAt { get; set; } [System.Text.Json.Serialization.JsonPropertyName("segment")] @@ -5512,29 +5808,26 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum RolloutSegmentOperator + public partial record RolloutList { - [System.Runtime.Serialization.EnumMember(Value = @"OR_SEGMENT_OPERATOR")] - OR_SEGMENT_OPERATOR = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"AND_SEGMENT_OPERATOR")] - AND_SEGMENT_OPERATOR = 1, - - } + [System.Text.Json.Serialization.JsonPropertyName("rules")] + public System.Collections.Generic.ICollection Rules { get; set; } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum RolloutType - { + [System.Text.Json.Serialization.JsonPropertyName("nextPageToken")] + public string NextPageToken { get; set; } - [System.Runtime.Serialization.EnumMember(Value = @"UNKNOWN_ROLLOUT_TYPE")] - UNKNOWN_ROLLOUT_TYPE = 0, + [System.Text.Json.Serialization.JsonPropertyName("totalCount")] + public int TotalCount { get; set; } - [System.Runtime.Serialization.EnumMember(Value = @"SEGMENT_ROLLOUT_TYPE")] - SEGMENT_ROLLOUT_TYPE = 1, + private System.Collections.Generic.IDictionary _additionalProperties; - [System.Runtime.Serialization.EnumMember(Value = @"THRESHOLD_ROLLOUT_TYPE")] - THRESHOLD_ROLLOUT_TYPE = 2, + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } } @@ -5543,18 +5836,17 @@ public partial record RolloutSegment { [System.Text.Json.Serialization.JsonPropertyName("segmentKey")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string SegmentKey { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("value")] + public bool Value { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("segmentKeys")] public System.Collections.Generic.ICollection SegmentKeys { get; set; } [System.Text.Json.Serialization.JsonPropertyName("segmentOperator")] [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public RolloutSegmentOperator SegmentOperator { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("value")] - public bool Value { get; set; } + public RolloutSegmentSegmentOperator SegmentOperator { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -5572,7 +5864,7 @@ public partial record RolloutThreshold { [System.Text.Json.Serialization.JsonPropertyName("percentage")] - public double Percentage { get; set; } + public float Percentage { get; set; } [System.Text.Json.Serialization.JsonPropertyName("value")] public bool Value { get; set; } @@ -5589,63 +5881,39 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record RolloutCreateRequest + public partial record Rule { - [System.Text.Json.Serialization.JsonPropertyName("rank")] - public int Rank { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("id")] + public string Id { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("flagKey")] + public string FlagKey { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("segment")] - public RolloutSegment Segment { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("segmentKey")] + public string SegmentKey { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("threshold")] - public RolloutThreshold Threshold { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("distributions")] + public System.Collections.Generic.ICollection Distributions { get; set; } - private System.Collections.Generic.IDictionary _additionalProperties; + [System.Text.Json.Serialization.JsonPropertyName("rank")] + public int Rank { get; set; } - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record RolloutUpdateRequest - { - - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("segment")] - public RolloutSegment Segment { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("threshold")] - public RolloutThreshold Threshold { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; + [System.Text.Json.Serialization.JsonPropertyName("createdAt")] + public System.DateTimeOffset CreatedAt { get; set; } - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } + [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] + public System.DateTimeOffset UpdatedAt { get; set; } - } + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + public string NamespaceKey { get; set; } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record RolloutOrderRequest - { + [System.Text.Json.Serialization.JsonPropertyName("segmentKeys")] + public System.Collections.Generic.ICollection SegmentKeys { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("rolloutIds")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection RolloutIds { get; set; } = new System.Collections.ObjectModel.Collection(); + [System.Text.Json.Serialization.JsonPropertyName("segmentOperator")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public RuleSegmentOperator SegmentOperator { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -5663,11 +5931,9 @@ public partial record RuleList { [System.Text.Json.Serialization.JsonPropertyName("rules")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Rules { get; set; } = new System.Collections.ObjectModel.Collection(); + public System.Collections.Generic.ICollection Rules { get; set; } [System.Text.Json.Serialization.JsonPropertyName("nextPageToken")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string NextPageToken { get; set; } [System.Text.Json.Serialization.JsonPropertyName("totalCount")] @@ -5685,60 +5951,34 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum RuleSegmentOperator - { - - [System.Runtime.Serialization.EnumMember(Value = @"OR_SEGMENT_OPERATOR")] - OR_SEGMENT_OPERATOR = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"AND_SEGMENT_OPERATOR")] - AND_SEGMENT_OPERATOR = 1, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record Rule + public partial record Segment { - [System.Text.Json.Serialization.JsonPropertyName("id")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string NamespaceKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("flagKey")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string FlagKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("segmentKey")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string SegmentKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("segmentKeys")] - public System.Collections.Generic.ICollection SegmentKeys { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("segmentOperator")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public RuleSegmentOperator SegmentOperator { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("key")] + public string Key { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("distributions")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Distributions { get; set; } = new System.Collections.ObjectModel.Collection(); + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("rank")] - public int Rank { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("description")] + public string Description { get; set; } [System.Text.Json.Serialization.JsonPropertyName("createdAt")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public System.DateTimeOffset CreatedAt { get; set; } [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public System.DateTimeOffset UpdatedAt { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("constraints")] + public System.Collections.Generic.ICollection Constraints { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("matchType")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public SegmentMatchType MatchType { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + public string NamespaceKey { get; set; } + private System.Collections.Generic.IDictionary _additionalProperties; [System.Text.Json.Serialization.JsonExtensionData] @@ -5751,22 +5991,17 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record RuleCreateRequest + public partial record SegmentList { - [System.Text.Json.Serialization.JsonPropertyName("segmentKey")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string SegmentKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("segmentKeys")] - public System.Collections.Generic.ICollection SegmentKeys { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("segments")] + public System.Collections.Generic.ICollection Segments { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("segmentOperator")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public RuleSegmentOperator SegmentOperator { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("nextPageToken")] + public string NextPageToken { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("rank")] - public int Rank { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("totalCount")] + public int TotalCount { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -5780,38 +6015,36 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record RuleOrderRequest + public partial record UpdateConstraintRequest { - [System.Text.Json.Serialization.JsonPropertyName("ruleIds")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection RuleIds { get; set; } = new System.Collections.ObjectModel.Collection(); - - private System.Collections.Generic.IDictionary _additionalProperties; + [System.Text.Json.Serialization.JsonPropertyName("id")] + public string Id { get; set; } - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } + [System.Text.Json.Serialization.JsonPropertyName("segmentKey")] + public string SegmentKey { get; set; } - } + [System.Text.Json.Serialization.JsonPropertyName("type")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public UpdateConstraintRequestType Type { get; set; } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record RuleUpdateRequest - { + [System.Text.Json.Serialization.JsonPropertyName("property")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Property { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("segmentKey")] + [System.Text.Json.Serialization.JsonPropertyName("operator")] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string SegmentKey { get; set; } + public string Operator { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("segmentKeys")] - public System.Collections.Generic.ICollection SegmentKeys { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("value")] + public string Value { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("segmentOperator")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public RuleSegmentOperator SegmentOperator { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + public string NamespaceKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("description")] + public string Description { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -5825,19 +6058,27 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record SegmentList + public partial record UpdateDistributionRequest { - [System.Text.Json.Serialization.JsonPropertyName("segments")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Segments { get; set; } = new System.Collections.ObjectModel.Collection(); + [System.Text.Json.Serialization.JsonPropertyName("id")] + public string Id { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("nextPageToken")] + [System.Text.Json.Serialization.JsonPropertyName("flagKey")] + public string FlagKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("ruleId")] + public string RuleId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("variantId")] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string NextPageToken { get; set; } + public string VariantId { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("totalCount")] - public int TotalCount { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("rollout")] + public float Rollout { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + public string NamespaceKey { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -5851,15 +6092,10 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record Segment + public partial record UpdateFlagRequest { - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string NamespaceKey { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("key")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Key { get; set; } [System.Text.Json.Serialization.JsonPropertyName("name")] @@ -5867,25 +6103,19 @@ public partial record Segment public string Name { get; set; } [System.Text.Json.Serialization.JsonPropertyName("description")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Description { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("createdAt")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public System.DateTimeOffset CreatedAt { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("enabled")] + public bool Enabled { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public System.DateTimeOffset UpdatedAt { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + public string NamespaceKey { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("constraints")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Constraints { get; set; } = new System.Collections.ObjectModel.Collection(); + [System.Text.Json.Serialization.JsonPropertyName("defaultVariantId")] + public string DefaultVariantId { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("matchType")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public SegmentMatchType MatchType { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("metadata")] + public object Metadata { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -5899,23 +6129,10 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum SegmentMatchType - { - - [System.Runtime.Serialization.EnumMember(Value = @"ALL_MATCH_TYPE")] - ALL_MATCH_TYPE = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"ANY_MATCH_TYPE")] - ANY_MATCH_TYPE = 1, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record SegmentCreateRequest + public partial record UpdateNamespaceRequest { [System.Text.Json.Serialization.JsonPropertyName("key")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Key { get; set; } [System.Text.Json.Serialization.JsonPropertyName("name")] @@ -5923,14 +6140,8 @@ public partial record SegmentCreateRequest public string Name { get; set; } [System.Text.Json.Serialization.JsonPropertyName("description")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Description { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("matchType")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public SegmentMatchType MatchType { get; set; } - private System.Collections.Generic.IDictionary _additionalProperties; [System.Text.Json.Serialization.JsonExtensionData] @@ -5943,21 +6154,26 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record SegmentUpdateRequest + public partial record UpdateRolloutRequest { - [System.Text.Json.Serialization.JsonPropertyName("name")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Name { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("id")] + public string Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + public string NamespaceKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("flagKey")] + public string FlagKey { get; set; } [System.Text.Json.Serialization.JsonPropertyName("description")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Description { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("matchType")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public SegmentMatchType MatchType { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("segment")] + public RolloutSegment Segment { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("threshold")] + public RolloutThreshold Threshold { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -5971,44 +6187,60 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record Variant + public partial record UpdateRuleRequest { [System.Text.Json.Serialization.JsonPropertyName("id")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Id { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string NamespaceKey { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("flagKey")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string FlagKey { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("key")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Key { get; set; } - + [System.Text.Json.Serialization.JsonPropertyName("segmentKey")] + public string SegmentKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + public string NamespaceKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("segmentKeys")] + public System.Collections.Generic.ICollection SegmentKeys { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("segmentOperator")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public UpdateRuleRequestSegmentOperator SegmentOperator { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial record UpdateSegmentRequest + { + + [System.Text.Json.Serialization.JsonPropertyName("key")] + public string Key { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("name")] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Name { get; set; } [System.Text.Json.Serialization.JsonPropertyName("description")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Description { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("createdAt")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public System.DateTimeOffset CreatedAt { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] + [System.Text.Json.Serialization.JsonPropertyName("matchType")] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public System.DateTimeOffset UpdatedAt { get; set; } + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public UpdateSegmentRequestMatchType MatchType { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("attachment")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Attachment { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + public string NamespaceKey { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -6022,9 +6254,15 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record VariantCreateRequest + public partial record UpdateVariantRequest { + [System.Text.Json.Serialization.JsonPropertyName("id")] + public string Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("flagKey")] + public string FlagKey { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("key")] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Key { get; set; } @@ -6038,6 +6276,9 @@ public partial record VariantCreateRequest [System.Text.Json.Serialization.JsonPropertyName("attachment")] public string Attachment { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + public string NamespaceKey { get; set; } + private System.Collections.Generic.IDictionary _additionalProperties; [System.Text.Json.Serialization.JsonExtensionData] @@ -6050,11 +6291,16 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record VariantUpdateRequest + public partial record Variant { + [System.Text.Json.Serialization.JsonPropertyName("id")] + public string Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("flagKey")] + public string FlagKey { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("key")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Key { get; set; } [System.Text.Json.Serialization.JsonPropertyName("name")] @@ -6063,9 +6309,18 @@ public partial record VariantUpdateRequest [System.Text.Json.Serialization.JsonPropertyName("description")] public string Description { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("createdAt")] + public System.DateTimeOffset CreatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] + public System.DateTimeOffset UpdatedAt { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("attachment")] public string Attachment { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] + public string NamespaceKey { get; set; } + private System.Collections.Generic.IDictionary _additionalProperties; [System.Text.Json.Serialization.JsonExtensionData] @@ -6078,12 +6333,36 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record Body + public partial record VariantEvaluationResponse { - [System.Text.Json.Serialization.JsonPropertyName("serviceAccountToken")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string ServiceAccountToken { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("match")] + public bool Match { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("segmentKeys")] + public System.Collections.Generic.ICollection SegmentKeys { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("reason")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public VariantEvaluationResponseReason Reason { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("variantKey")] + public string VariantKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("variantAttachment")] + public string VariantAttachment { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("requestId")] + public string RequestId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("requestDurationMillis")] + public double RequestDurationMillis { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("timestamp")] + public System.DateTimeOffset Timestamp { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("flagKey")] + public string FlagKey { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -6097,22 +6376,11 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record Body2 + public partial record VerifyServiceAccountRequest { - [System.Text.Json.Serialization.JsonPropertyName("name")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - public string NamespaceKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("description")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Description { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("expiresAt")] - public System.DateTimeOffset ExpiresAt { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("serviceAccountToken")] + public string ServiceAccountToken { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -6126,11 +6394,14 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record Body3 + public partial record VerifyServiceAccountResponse { - [System.Text.Json.Serialization.JsonPropertyName("expiresAt")] - public System.DateTimeOffset ExpiresAt { get; set; } + [System.Text.Json.Serialization.JsonPropertyName("clientToken")] + public string ClientToken { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("authentication")] + public Authentication Authentication { get; set; } private System.Collections.Generic.IDictionary _additionalProperties; @@ -6143,6 +6414,336 @@ public System.Collections.Generic.IDictionary AdditionalProperti } + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum Method + { + + [System.Runtime.Serialization.EnumMember(Value = @"METHOD_NONE")] + METHOD_NONE = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"METHOD_TOKEN")] + METHOD_TOKEN = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"METHOD_OIDC")] + METHOD_OIDC = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"METHOD_KUBERNETES")] + METHOD_KUBERNETES = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"METHOD_GITHUB")] + METHOD_GITHUB = 4, + + [System.Runtime.Serialization.EnumMember(Value = @"METHOD_JWT")] + METHOD_JWT = 5, + + [System.Runtime.Serialization.EnumMember(Value = @"METHOD_CLOUD")] + METHOD_CLOUD = 6, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum AuthenticationMethod + { + + [System.Runtime.Serialization.EnumMember(Value = @"METHOD_NONE")] + METHOD_NONE = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"METHOD_TOKEN")] + METHOD_TOKEN = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"METHOD_OIDC")] + METHOD_OIDC = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"METHOD_KUBERNETES")] + METHOD_KUBERNETES = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"METHOD_GITHUB")] + METHOD_GITHUB = 4, + + [System.Runtime.Serialization.EnumMember(Value = @"METHOD_JWT")] + METHOD_JWT = 5, + + [System.Runtime.Serialization.EnumMember(Value = @"METHOD_CLOUD")] + METHOD_CLOUD = 6, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum BooleanEvaluationResponseReason + { + + [System.Runtime.Serialization.EnumMember(Value = @"UNKNOWN_EVALUATION_REASON")] + UNKNOWN_EVALUATION_REASON = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"FLAG_DISABLED_EVALUATION_REASON")] + FLAG_DISABLED_EVALUATION_REASON = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"MATCH_EVALUATION_REASON")] + MATCH_EVALUATION_REASON = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"DEFAULT_EVALUATION_REASON")] + DEFAULT_EVALUATION_REASON = 3, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum ConstraintType + { + + [System.Runtime.Serialization.EnumMember(Value = @"UNKNOWN_COMPARISON_TYPE")] + UNKNOWN_COMPARISON_TYPE = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"STRING_COMPARISON_TYPE")] + STRING_COMPARISON_TYPE = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"NUMBER_COMPARISON_TYPE")] + NUMBER_COMPARISON_TYPE = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"BOOLEAN_COMPARISON_TYPE")] + BOOLEAN_COMPARISON_TYPE = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"DATETIME_COMPARISON_TYPE")] + DATETIME_COMPARISON_TYPE = 4, + + [System.Runtime.Serialization.EnumMember(Value = @"ENTITY_ID_COMPARISON_TYPE")] + ENTITY_ID_COMPARISON_TYPE = 5, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum CreateConstraintRequestType + { + + [System.Runtime.Serialization.EnumMember(Value = @"UNKNOWN_COMPARISON_TYPE")] + UNKNOWN_COMPARISON_TYPE = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"STRING_COMPARISON_TYPE")] + STRING_COMPARISON_TYPE = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"NUMBER_COMPARISON_TYPE")] + NUMBER_COMPARISON_TYPE = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"BOOLEAN_COMPARISON_TYPE")] + BOOLEAN_COMPARISON_TYPE = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"DATETIME_COMPARISON_TYPE")] + DATETIME_COMPARISON_TYPE = 4, + + [System.Runtime.Serialization.EnumMember(Value = @"ENTITY_ID_COMPARISON_TYPE")] + ENTITY_ID_COMPARISON_TYPE = 5, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum CreateFlagRequestType + { + + [System.Runtime.Serialization.EnumMember(Value = @"VARIANT_FLAG_TYPE")] + VARIANT_FLAG_TYPE = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"BOOLEAN_FLAG_TYPE")] + BOOLEAN_FLAG_TYPE = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum CreateRuleRequestSegmentOperator + { + + [System.Runtime.Serialization.EnumMember(Value = @"OR_SEGMENT_OPERATOR")] + OR_SEGMENT_OPERATOR = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"AND_SEGMENT_OPERATOR")] + AND_SEGMENT_OPERATOR = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum CreateSegmentRequestMatchType + { + + [System.Runtime.Serialization.EnumMember(Value = @"ALL_MATCH_TYPE")] + ALL_MATCH_TYPE = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"ANY_MATCH_TYPE")] + ANY_MATCH_TYPE = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum ErrorEvaluationResponseReason + { + + [System.Runtime.Serialization.EnumMember(Value = @"UNKNOWN_ERROR_EVALUATION_REASON")] + UNKNOWN_ERROR_EVALUATION_REASON = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"NOT_FOUND_ERROR_EVALUATION_REASON")] + NOT_FOUND_ERROR_EVALUATION_REASON = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum EvaluatedFlagReason + { + + [System.Runtime.Serialization.EnumMember(Value = @"UNKNOWN")] + UNKNOWN = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"DISABLED")] + DISABLED = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"TARGETING_MATCH")] + TARGETING_MATCH = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"DEFAULT")] + DEFAULT = 3, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum EvaluationResponseType + { + + [System.Runtime.Serialization.EnumMember(Value = @"VARIANT_EVALUATION_RESPONSE_TYPE")] + VARIANT_EVALUATION_RESPONSE_TYPE = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"BOOLEAN_EVALUATION_RESPONSE_TYPE")] + BOOLEAN_EVALUATION_RESPONSE_TYPE = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"ERROR_EVALUATION_RESPONSE_TYPE")] + ERROR_EVALUATION_RESPONSE_TYPE = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum FlagType + { + + [System.Runtime.Serialization.EnumMember(Value = @"VARIANT_FLAG_TYPE")] + VARIANT_FLAG_TYPE = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"BOOLEAN_FLAG_TYPE")] + BOOLEAN_FLAG_TYPE = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum RolloutType + { + + [System.Runtime.Serialization.EnumMember(Value = @"UNKNOWN_ROLLOUT_TYPE")] + UNKNOWN_ROLLOUT_TYPE = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"SEGMENT_ROLLOUT_TYPE")] + SEGMENT_ROLLOUT_TYPE = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"THRESHOLD_ROLLOUT_TYPE")] + THRESHOLD_ROLLOUT_TYPE = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum RolloutSegmentSegmentOperator + { + + [System.Runtime.Serialization.EnumMember(Value = @"OR_SEGMENT_OPERATOR")] + OR_SEGMENT_OPERATOR = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"AND_SEGMENT_OPERATOR")] + AND_SEGMENT_OPERATOR = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum RuleSegmentOperator + { + + [System.Runtime.Serialization.EnumMember(Value = @"OR_SEGMENT_OPERATOR")] + OR_SEGMENT_OPERATOR = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"AND_SEGMENT_OPERATOR")] + AND_SEGMENT_OPERATOR = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum SegmentMatchType + { + + [System.Runtime.Serialization.EnumMember(Value = @"ALL_MATCH_TYPE")] + ALL_MATCH_TYPE = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"ANY_MATCH_TYPE")] + ANY_MATCH_TYPE = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum UpdateConstraintRequestType + { + + [System.Runtime.Serialization.EnumMember(Value = @"UNKNOWN_COMPARISON_TYPE")] + UNKNOWN_COMPARISON_TYPE = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"STRING_COMPARISON_TYPE")] + STRING_COMPARISON_TYPE = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"NUMBER_COMPARISON_TYPE")] + NUMBER_COMPARISON_TYPE = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"BOOLEAN_COMPARISON_TYPE")] + BOOLEAN_COMPARISON_TYPE = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"DATETIME_COMPARISON_TYPE")] + DATETIME_COMPARISON_TYPE = 4, + + [System.Runtime.Serialization.EnumMember(Value = @"ENTITY_ID_COMPARISON_TYPE")] + ENTITY_ID_COMPARISON_TYPE = 5, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum UpdateRuleRequestSegmentOperator + { + + [System.Runtime.Serialization.EnumMember(Value = @"OR_SEGMENT_OPERATOR")] + OR_SEGMENT_OPERATOR = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"AND_SEGMENT_OPERATOR")] + AND_SEGMENT_OPERATOR = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum UpdateSegmentRequestMatchType + { + + [System.Runtime.Serialization.EnumMember(Value = @"ALL_MATCH_TYPE")] + ALL_MATCH_TYPE = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"ANY_MATCH_TYPE")] + ANY_MATCH_TYPE = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public enum VariantEvaluationResponseReason + { + + [System.Runtime.Serialization.EnumMember(Value = @"UNKNOWN_EVALUATION_REASON")] + UNKNOWN_EVALUATION_REASON = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"FLAG_DISABLED_EVALUATION_REASON")] + FLAG_DISABLED_EVALUATION_REASON = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"MATCH_EVALUATION_REASON")] + MATCH_EVALUATION_REASON = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"DEFAULT_EVALUATION_REASON")] + DEFAULT_EVALUATION_REASON = 3, + + } + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs index 9f870235..6a78a2cb 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs @@ -47,7 +47,7 @@ public async Task> EvaluateAsync(string flagKey, T defau { var evaluationResponse = await fliptClientWrapper.EvaluateVariantAsync(evaluationRequest); - if (evaluationResponse.Reason == EvaluationReason.FLAG_DISABLED_EVALUATION_REASON) + if (evaluationResponse.Reason == VariantEvaluationResponseReason.FLAG_DISABLED_EVALUATION_REASON) return new ResolutionDetails(flagKey, defaultValue, ErrorType.None, Reason.Disabled); diff --git a/src/OpenFeature.Contrib.Providers.Flipt/README.md b/src/OpenFeature.Contrib.Providers.Flipt/README.md index 48c7eeda..cfe49768 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/README.md +++ b/src/OpenFeature.Contrib.Providers.Flipt/README.md @@ -48,13 +48,14 @@ packet add OpenFeature.Contrib.Providers.Flipt ## Using the Flipt Provider with the OpenFeature SDK -To create a Flagmith provider you should define provider and Flipt settings. +To create a Flipt provider you should define provider and pass in as parameters. ```csharp using OpenFeature.Contrib.Providers.Flipt; using OpenFeature.Model; -var featureProvider = new FliptProvider("http://localhost:8080", "default-namespace"); +// namespace and clientToken is optional +var featureProvider = new FliptProvider("http://localhost:8080", "default-namespace", "client-token"); // Set the featureProvider as the provider for the OpenFeature SDK await OpenFeature.Api.Instance.SetProviderAsync(featureProvider); @@ -84,7 +85,8 @@ dotnet 8.0, it was not utilized in this provider as OpenFeature aims to support ### Rest Client using OpenAPI -To work around this incompatibility, the openapi specification of [Flipt](https://github.com/flipt-io/flipt-openapi) was +To work around this incompatibility, the openapi specification +of [Flipt](https://github.com/flipt-io/flipt/blob/main/openapi.yaml) was used to generate a REST client using [nswag](https://github.com/RicoSuter/NSwag). ## Updating the REST Client @@ -93,12 +95,11 @@ To generate or update the Flipt REST client, follow these steps: ### 1. Download the OpenAPI Specification -First, download the latest `openapi.yml` file from the Flipt GitHub repository. This can be done manually or by using a +First, download the latest `openapi.yaml` file from the Flipt GitHub repository. This can be done manually or by using a command like `curl`: ``` - -curl https://raw.githubusercontent.com/flipt-io/flipt-openapi/main/openapi.yml -o openapi.yml +curl https://raw.githubusercontent.com/flipt-io/flipt/refs/heads/main/openapi.yaml -o openapi.yaml ``` ### 2. Generate the Client Code @@ -107,7 +108,7 @@ With the `openapi.yml` file in your working directory, run the following `nswag` code. Make sure to correct the command as shown below: ``` -nswag openapi2csclient /className:FliptRestClient /namespace:Flipt.Rest /input:"openapi.yml" /output:"./Flipt.Rest.Client.cs" /GenerateExceptionClasses:true /OperationGenerationMode:SingleClientFromPathSegments /JsonLibrary:SystemTextJson /GenerateOptionalParameters:true /GenerateDefaultValues:true /GenerateResponseClasses:true /GenerateClientInterfaces:true /GenerateClientClasses:true /GenerateDtoTypes:true /ExceptionClass:FliptRestException /GenerateNativeRecords:true /UseBaseUrl:false /GenerateBaseUrlProperty:false +nswag openapi2csclient /className:FliptRestClient /namespace:Flipt.Rest /input:"openapi.yaml" /output:"./Flipt.Rest.Client.cs" /GenerateExceptionClasses:true /OperationGenerationMode:SingleClientFromPathSegments /JsonLibrary:SystemTextJson /GenerateOptionalParameters:true /GenerateDefaultValues:true /GenerateResponseClasses:true /GenerateClientInterfaces:true /GenerateClientClasses:true /GenerateDtoTypes:true /ExceptionClass:FliptRestException /GenerateNativeRecords:true /UseBaseUrl:false /GenerateBaseUrlProperty:false ``` #### Notes diff --git a/src/OpenFeature.Contrib.Providers.Flipt/openapi.yaml b/src/OpenFeature.Contrib.Providers.Flipt/openapi.yaml new file mode 100644 index 00000000..8e2c006f --- /dev/null +++ b/src/OpenFeature.Contrib.Providers.Flipt/openapi.yaml @@ -0,0 +1,2310 @@ +# Generated with protoc-gen-openapi +# https://github.com/google/gnostic/tree/master/cmd/protoc-gen-openapi + +openapi: 3.0.3 +info: + title: api + version: 1.47.0 +servers: + - url: http://localhost:8080 +paths: + /api/v1/namespaces: + get: + tags: + - Flipt + - NamespacesService + operationId: listNamespaces + parameters: + - name: limit + in: query + schema: + type: integer + format: int32 + - name: offset + in: query + schema: + type: integer + format: int32 + - name: pageToken + in: query + schema: + type: string + - name: reference + in: query + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/NamespaceList' + post: + tags: + - Flipt + - NamespacesService + operationId: createNamespace + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateNamespaceRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Namespace' + /api/v1/namespaces/{key}: + get: + tags: + - Flipt + - NamespacesService + operationId: getNamespace + parameters: + - name: key + in: path + required: true + schema: + type: string + - name: reference + in: query + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Namespace' + put: + tags: + - Flipt + - NamespacesService + operationId: updateNamespace + parameters: + - name: key + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateNamespaceRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Namespace' + delete: + tags: + - Flipt + - NamespacesService + operationId: deleteNamespace + parameters: + - name: key + in: path + required: true + schema: + type: string + responses: + "200": + description: OK + content: {} + /api/v1/namespaces/{namespaceKey}/flags: + get: + tags: + - Flipt + - FlagsService + operationId: listFlags + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: limit + in: query + schema: + type: integer + format: int32 + - name: offset + in: query + schema: + type: integer + format: int32 + - name: pageToken + in: query + schema: + type: string + - name: reference + in: query + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/FlagList' + post: + tags: + - Flipt + - FlagsService + operationId: createFlag + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateFlagRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Flag' + /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts: + get: + tags: + - Flipt + - RolloutsService + operationId: listRollouts + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + - name: limit + in: query + schema: + type: integer + format: int32 + - name: pageToken + in: query + schema: + type: string + - name: reference + in: query + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RolloutList' + post: + tags: + - Flipt + - RolloutsService + operationId: createRollout + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateRolloutRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Rollout' + /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts/order: + put: + tags: + - Flipt + - RolloutsService + operationId: orderRollouts + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OrderRolloutsRequest' + required: true + responses: + "200": + description: OK + content: {} + /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts/{id}: + get: + tags: + - Flipt + - RolloutsService + operationId: getRollout + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + - name: reference + in: query + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Rollout' + put: + tags: + - Flipt + - RolloutsService + operationId: updateRollout + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateRolloutRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Rollout' + delete: + tags: + - Flipt + - RolloutsService + operationId: deleteRollout + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + responses: + "200": + description: OK + content: {} + /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules: + get: + tags: + - Flipt + - RulesService + operationId: listRules + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + - name: limit + in: query + schema: + type: integer + format: int32 + - name: offset + in: query + schema: + type: integer + format: int32 + - name: pageToken + in: query + schema: + type: string + - name: reference + in: query + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/RuleList' + post: + tags: + - Flipt + - RulesService + operationId: createRule + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateRuleRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Rule' + /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/order: + put: + tags: + - Flipt + - RulesService + operationId: orderRules + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OrderRulesRequest' + required: true + responses: + "200": + description: OK + content: {} + /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{id}: + get: + tags: + - Flipt + - RulesService + operationId: getRule + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + - name: reference + in: query + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Rule' + put: + tags: + - Flipt + - RulesService + operationId: updateRule + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateRuleRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Rule' + delete: + tags: + - Flipt + - RulesService + operationId: deleteRule + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + responses: + "200": + description: OK + content: {} + /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{ruleId}/distributions: + post: + tags: + - Flipt + - DistributionsService + operationId: createDistribution + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + - name: ruleId + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateDistributionRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Distribution' + /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{ruleId}/distributions/{id}: + put: + tags: + - Flipt + - DistributionsService + operationId: updateDistribution + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + - name: ruleId + in: path + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateDistributionRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Distribution' + delete: + tags: + - Flipt + - DistributionsService + operationId: deleteDistribution + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + - name: ruleId + in: path + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + - name: variantId + in: query + schema: + type: string + responses: + "200": + description: OK + content: {} + /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/variants: + post: + tags: + - Flipt + - VariantsService + operationId: createVariant + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateVariantRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Variant' + /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/variants/{id}: + put: + tags: + - Flipt + - VariantsService + operationId: updateVariant + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateVariantRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Variant' + delete: + tags: + - Flipt + - VariantsService + operationId: deleteVariant + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: flagKey + in: path + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + responses: + "200": + description: OK + content: {} + /api/v1/namespaces/{namespaceKey}/flags/{key}: + get: + tags: + - Flipt + - FlagsService + operationId: getFlag + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: key + in: path + required: true + schema: + type: string + - name: reference + in: query + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Flag' + put: + tags: + - Flipt + - FlagsService + operationId: updateFlag + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: key + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateFlagRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Flag' + delete: + tags: + - Flipt + - FlagsService + operationId: deleteFlag + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: key + in: path + required: true + schema: + type: string + responses: + "200": + description: OK + content: {} + /api/v1/namespaces/{namespaceKey}/segments: + get: + tags: + - Flipt + - SegmentsService + operationId: listSegments + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: limit + in: query + schema: + type: integer + format: int32 + - name: offset + in: query + schema: + type: integer + format: int32 + - name: pageToken + in: query + schema: + type: string + - name: reference + in: query + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/SegmentList' + post: + tags: + - Flipt + - SegmentsService + operationId: createSegment + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateSegmentRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Segment' + /api/v1/namespaces/{namespaceKey}/segments/{key}: + get: + tags: + - Flipt + - SegmentsService + operationId: getSegment + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: key + in: path + required: true + schema: + type: string + - name: reference + in: query + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Segment' + put: + tags: + - Flipt + - SegmentsService + operationId: updateSegment + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: key + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateSegmentRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Segment' + delete: + tags: + - Flipt + - SegmentsService + operationId: deleteSegment + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: key + in: path + required: true + schema: + type: string + responses: + "200": + description: OK + content: {} + /api/v1/namespaces/{namespaceKey}/segments/{segmentKey}/constraints: + post: + tags: + - Flipt + - ConstraintsService + operationId: createConstraint + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: segmentKey + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateConstraintRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Constraint' + /api/v1/namespaces/{namespaceKey}/segments/{segmentKey}/constraints/{id}: + put: + tags: + - Flipt + - ConstraintsService + operationId: updateConstraint + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: segmentKey + in: path + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateConstraintRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Constraint' + delete: + tags: + - Flipt + - ConstraintsService + operationId: deleteConstraint + parameters: + - name: namespaceKey + in: path + required: true + schema: + type: string + - name: segmentKey + in: path + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + responses: + "200": + description: OK + content: {} + /auth/v1/method/kubernetes/serviceaccount: + post: + tags: + - AuthenticationMethodKubernetesService + operationId: kubernetesVerifyServiceAccount + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/VerifyServiceAccountRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VerifyServiceAccountResponse' + /auth/v1/method/oidc/{provider}/authorize: + get: + tags: + - AuthenticationMethodOIDCService + operationId: oidcAuthorizeURL + parameters: + - name: provider + in: path + required: true + schema: + type: string + - name: state + in: query + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AuthorizeURLResponse' + /auth/v1/method/oidc/{provider}/callback: + get: + tags: + - AuthenticationMethodOIDCService + operationId: oidcCallback + parameters: + - name: provider + in: path + required: true + schema: + type: string + - name: code + in: query + schema: + type: string + - name: state + in: query + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/CallbackResponse' + /auth/v1/method/token: + post: + tags: + - AuthenticationMethodTokenService + operationId: createMethodToken + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateTokenRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/CreateTokenResponse' + /auth/v1/self: + get: + tags: + - AuthenticationService + operationId: getAuthSelf + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Authentication' + /auth/v1/self/expire: + put: + tags: + - AuthenticationService + operationId: expireAuthSelf + parameters: + - name: expiresAt + in: query + schema: + type: string + format: date-time + responses: + "200": + description: OK + content: {} + /auth/v1/tokens: + get: + tags: + - AuthenticationService + operationId: listAuthTokens + parameters: + - name: method + in: query + schema: + enum: + - METHOD_NONE + - METHOD_TOKEN + - METHOD_OIDC + - METHOD_KUBERNETES + - METHOD_GITHUB + - METHOD_JWT + - METHOD_CLOUD + type: string + format: enum + - name: limit + in: query + schema: + type: integer + format: int32 + - name: pageToken + in: query + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListAuthenticationsResponse' + /auth/v1/tokens/{id}: + get: + tags: + - AuthenticationService + operationId: getAuthToken + parameters: + - name: id + in: path + required: true + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Authentication' + delete: + tags: + - AuthenticationService + operationId: deleteAuthToken + parameters: + - name: id + in: path + required: true + schema: + type: string + responses: + "200": + description: OK + content: {} + /evaluate/v1/batch: + post: + tags: + - EvaluationService + operationId: evaluateBatch + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BatchEvaluationRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/BatchEvaluationResponse' + /evaluate/v1/boolean: + post: + tags: + - EvaluationService + operationId: evaluateBoolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/EvaluationRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/BooleanEvaluationResponse' + /evaluate/v1/variant: + post: + tags: + - EvaluationService + operationId: evaluateVariant + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/EvaluationRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VariantEvaluationResponse' + /ofrep/v1/configuration: + get: + tags: + - OFREPService + description: OFREP provider configuration + operationId: ofrep.configuration + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/GetProviderConfigurationResponse' + /ofrep/v1/evaluate/flags: + post: + tags: + - OFREPService + description: OFREP bulk flag evaluation + operationId: ofrep.evaluateBulk + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/EvaluateBulkRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/BulkEvaluationResponse' + /ofrep/v1/evaluate/flags/{key}: + post: + tags: + - OFREPService + description: OFREP single flag evaluation + operationId: ofrep.evaluateFlag + parameters: + - name: key + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/EvaluateFlagRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/EvaluatedFlag' +components: + schemas: + Authentication: + type: object + properties: + id: + type: string + method: + enum: + - METHOD_NONE + - METHOD_TOKEN + - METHOD_OIDC + - METHOD_KUBERNETES + - METHOD_GITHUB + - METHOD_JWT + - METHOD_CLOUD + type: string + format: enum + expiresAt: + type: string + format: date-time + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + metadata: + type: object + additionalProperties: + type: string + AuthorizeURLResponse: + type: object + properties: + authorizeUrl: + type: string + BatchEvaluationRequest: + required: + - requests + type: object + properties: + requestId: + type: string + requests: + type: array + items: + $ref: '#/components/schemas/EvaluationRequest' + reference: + type: string + BatchEvaluationResponse: + type: object + properties: + requestId: + type: string + responses: + type: array + items: + $ref: '#/components/schemas/EvaluationResponse' + requestDurationMillis: + type: number + format: double + BooleanEvaluationResponse: + type: object + properties: + enabled: + type: boolean + reason: + enum: + - UNKNOWN_EVALUATION_REASON + - FLAG_DISABLED_EVALUATION_REASON + - MATCH_EVALUATION_REASON + - DEFAULT_EVALUATION_REASON + type: string + format: enum + requestId: + type: string + requestDurationMillis: + type: number + format: double + timestamp: + type: string + format: date-time + flagKey: + type: string + BulkEvaluationResponse: + required: + - flags + type: object + properties: + flags: + type: array + items: + $ref: '#/components/schemas/EvaluatedFlag' + CacheInvalidation: + type: object + properties: + polling: + $ref: '#/components/schemas/Polling' + CallbackResponse: + type: object + properties: + clientToken: + type: string + authentication: + $ref: '#/components/schemas/Authentication' + Capabilities: + type: object + properties: + cacheInvalidation: + $ref: '#/components/schemas/CacheInvalidation' + flagEvaluation: + $ref: '#/components/schemas/FlagEvaluation' + Constraint: + type: object + properties: + id: + type: string + segmentKey: + type: string + type: + enum: + - UNKNOWN_COMPARISON_TYPE + - STRING_COMPARISON_TYPE + - NUMBER_COMPARISON_TYPE + - BOOLEAN_COMPARISON_TYPE + - DATETIME_COMPARISON_TYPE + - ENTITY_ID_COMPARISON_TYPE + type: string + format: enum + property: + type: string + operator: + type: string + value: + type: string + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + namespaceKey: + type: string + description: + type: string + CreateConstraintRequest: + required: + - type + - property + - operator + type: object + properties: + segmentKey: + type: string + type: + enum: + - UNKNOWN_COMPARISON_TYPE + - STRING_COMPARISON_TYPE + - NUMBER_COMPARISON_TYPE + - BOOLEAN_COMPARISON_TYPE + - DATETIME_COMPARISON_TYPE + - ENTITY_ID_COMPARISON_TYPE + type: string + format: enum + property: + type: string + operator: + type: string + value: + type: string + namespaceKey: + type: string + description: + type: string + CreateDistributionRequest: + required: + - variantId + - rollout + type: object + properties: + flagKey: + type: string + ruleId: + type: string + variantId: + type: string + rollout: + type: number + format: float + namespaceKey: + type: string + CreateFlagRequest: + required: + - key + - name + - type + type: object + properties: + key: + type: string + name: + type: string + description: + type: string + enabled: + type: boolean + namespaceKey: + type: string + type: + enum: + - VARIANT_FLAG_TYPE + - BOOLEAN_FLAG_TYPE + type: string + format: enum + metadata: + type: object + CreateNamespaceRequest: + required: + - key + - name + type: object + properties: + key: + type: string + name: + type: string + description: + type: string + CreateRolloutRequest: + required: + - rank + type: object + properties: + namespaceKey: + type: string + flagKey: + type: string + rank: + type: integer + format: int32 + description: + type: string + segment: + $ref: '#/components/schemas/RolloutSegment' + threshold: + $ref: '#/components/schemas/RolloutThreshold' + CreateRuleRequest: + required: + - rank + type: object + properties: + flagKey: + type: string + segmentKey: + type: string + rank: + type: integer + format: int32 + namespaceKey: + type: string + segmentKeys: + type: array + items: + type: string + segmentOperator: + enum: + - OR_SEGMENT_OPERATOR + - AND_SEGMENT_OPERATOR + type: string + format: enum + CreateSegmentRequest: + required: + - key + - name + - matchType + type: object + properties: + key: + type: string + name: + type: string + description: + type: string + matchType: + enum: + - ALL_MATCH_TYPE + - ANY_MATCH_TYPE + type: string + format: enum + namespaceKey: + type: string + CreateTokenRequest: + type: object + properties: + name: + type: string + description: + type: string + expiresAt: + type: string + format: date-time + namespaceKey: + type: string + metadata: + type: object + additionalProperties: + type: string + CreateTokenResponse: + type: object + properties: + clientToken: + type: string + authentication: + $ref: '#/components/schemas/Authentication' + CreateVariantRequest: + required: + - key + type: object + properties: + flagKey: + type: string + key: + type: string + name: + type: string + description: + type: string + attachment: + type: string + namespaceKey: + type: string + Distribution: + type: object + properties: + id: + type: string + ruleId: + type: string + variantId: + type: string + rollout: + type: number + format: float + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + ErrorEvaluationResponse: + type: object + properties: + flagKey: + type: string + namespaceKey: + type: string + reason: + enum: + - UNKNOWN_ERROR_EVALUATION_REASON + - NOT_FOUND_ERROR_EVALUATION_REASON + type: string + format: enum + EvaluateBulkRequest: + type: object + properties: + context: + type: object + additionalProperties: + type: string + EvaluateFlagRequest: + type: object + properties: + key: + type: string + context: + type: object + additionalProperties: + type: string + EvaluatedFlag: + type: object + properties: + key: + type: string + reason: + enum: + - UNKNOWN + - DISABLED + - TARGETING_MATCH + - DEFAULT + type: string + format: enum + variant: + type: string + metadata: + type: object + value: + $ref: '#/components/schemas/GoogleProtobufValue' + EvaluationRequest: + required: + - namespaceKey + - flagKey + - entityId + - context + type: object + properties: + requestId: + type: string + namespaceKey: + type: string + flagKey: + type: string + entityId: + type: string + context: + type: object + additionalProperties: + type: string + reference: + type: string + EvaluationResponse: + type: object + properties: + type: + enum: + - VARIANT_EVALUATION_RESPONSE_TYPE + - BOOLEAN_EVALUATION_RESPONSE_TYPE + - ERROR_EVALUATION_RESPONSE_TYPE + type: string + format: enum + booleanResponse: + $ref: '#/components/schemas/BooleanEvaluationResponse' + variantResponse: + $ref: '#/components/schemas/VariantEvaluationResponse' + errorResponse: + $ref: '#/components/schemas/ErrorEvaluationResponse' + Flag: + type: object + properties: + key: + type: string + name: + type: string + description: + type: string + enabled: + type: boolean + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + variants: + type: array + items: + $ref: '#/components/schemas/Variant' + namespaceKey: + type: string + type: + enum: + - VARIANT_FLAG_TYPE + - BOOLEAN_FLAG_TYPE + type: string + format: enum + defaultVariant: + $ref: '#/components/schemas/Variant' + metadata: + type: object + FlagEvaluation: + type: object + properties: + supportedTypes: + type: array + items: + type: string + FlagList: + type: object + properties: + flags: + type: array + items: + $ref: '#/components/schemas/Flag' + nextPageToken: + type: string + totalCount: + type: integer + format: int32 + GetProviderConfigurationResponse: + type: object + properties: + name: + type: string + capabilities: + $ref: '#/components/schemas/Capabilities' + GoogleProtobufValue: + description: Represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values. + ListAuthenticationsResponse: + type: object + properties: + authentications: + type: array + items: + $ref: '#/components/schemas/Authentication' + nextPageToken: + type: string + Namespace: + type: object + properties: + key: + type: string + name: + type: string + description: + type: string + protected: + type: boolean + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + NamespaceList: + type: object + properties: + namespaces: + type: array + items: + $ref: '#/components/schemas/Namespace' + nextPageToken: + type: string + totalCount: + type: integer + format: int32 + OrderRolloutsRequest: + required: + - rolloutIds + type: object + properties: + flagKey: + type: string + namespaceKey: + type: string + rolloutIds: + type: array + items: + type: string + OrderRulesRequest: + required: + - ruleIds + type: object + properties: + flagKey: + type: string + ruleIds: + type: array + items: + type: string + namespaceKey: + type: string + Polling: + type: object + properties: + enabled: + type: boolean + minPollingIntervalMs: + type: integer + format: uint32 + Rollout: + type: object + properties: + id: + type: string + namespaceKey: + type: string + flagKey: + type: string + type: + enum: + - UNKNOWN_ROLLOUT_TYPE + - SEGMENT_ROLLOUT_TYPE + - THRESHOLD_ROLLOUT_TYPE + type: string + format: enum + rank: + type: integer + format: int32 + description: + type: string + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + segment: + $ref: '#/components/schemas/RolloutSegment' + threshold: + $ref: '#/components/schemas/RolloutThreshold' + RolloutList: + type: object + properties: + rules: + type: array + items: + $ref: '#/components/schemas/Rollout' + nextPageToken: + type: string + totalCount: + type: integer + format: int32 + RolloutSegment: + type: object + properties: + segmentKey: + type: string + value: + type: boolean + segmentKeys: + type: array + items: + type: string + segmentOperator: + enum: + - OR_SEGMENT_OPERATOR + - AND_SEGMENT_OPERATOR + type: string + format: enum + RolloutThreshold: + type: object + properties: + percentage: + type: number + format: float + value: + type: boolean + Rule: + type: object + properties: + id: + type: string + flagKey: + type: string + segmentKey: + type: string + distributions: + type: array + items: + $ref: '#/components/schemas/Distribution' + rank: + type: integer + format: int32 + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + namespaceKey: + type: string + segmentKeys: + type: array + items: + type: string + segmentOperator: + enum: + - OR_SEGMENT_OPERATOR + - AND_SEGMENT_OPERATOR + type: string + format: enum + RuleList: + type: object + properties: + rules: + type: array + items: + $ref: '#/components/schemas/Rule' + nextPageToken: + type: string + totalCount: + type: integer + format: int32 + Segment: + type: object + properties: + key: + type: string + name: + type: string + description: + type: string + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + constraints: + type: array + items: + $ref: '#/components/schemas/Constraint' + matchType: + enum: + - ALL_MATCH_TYPE + - ANY_MATCH_TYPE + type: string + format: enum + namespaceKey: + type: string + SegmentList: + type: object + properties: + segments: + type: array + items: + $ref: '#/components/schemas/Segment' + nextPageToken: + type: string + totalCount: + type: integer + format: int32 + UpdateConstraintRequest: + required: + - type + - property + - operator + type: object + properties: + id: + type: string + segmentKey: + type: string + type: + enum: + - UNKNOWN_COMPARISON_TYPE + - STRING_COMPARISON_TYPE + - NUMBER_COMPARISON_TYPE + - BOOLEAN_COMPARISON_TYPE + - DATETIME_COMPARISON_TYPE + - ENTITY_ID_COMPARISON_TYPE + type: string + format: enum + property: + type: string + operator: + type: string + value: + type: string + namespaceKey: + type: string + description: + type: string + UpdateDistributionRequest: + required: + - variantId + - rollout + type: object + properties: + id: + type: string + flagKey: + type: string + ruleId: + type: string + variantId: + type: string + rollout: + type: number + format: float + namespaceKey: + type: string + UpdateFlagRequest: + required: + - name + type: object + properties: + key: + type: string + name: + type: string + description: + type: string + enabled: + type: boolean + namespaceKey: + type: string + defaultVariantId: + type: string + metadata: + type: object + UpdateNamespaceRequest: + required: + - name + type: object + properties: + key: + type: string + name: + type: string + description: + type: string + UpdateRolloutRequest: + type: object + properties: + id: + type: string + namespaceKey: + type: string + flagKey: + type: string + description: + type: string + segment: + $ref: '#/components/schemas/RolloutSegment' + threshold: + $ref: '#/components/schemas/RolloutThreshold' + UpdateRuleRequest: + type: object + properties: + id: + type: string + flagKey: + type: string + segmentKey: + type: string + namespaceKey: + type: string + segmentKeys: + type: array + items: + type: string + segmentOperator: + enum: + - OR_SEGMENT_OPERATOR + - AND_SEGMENT_OPERATOR + type: string + format: enum + UpdateSegmentRequest: + required: + - name + - matchType + type: object + properties: + key: + type: string + name: + type: string + description: + type: string + matchType: + enum: + - ALL_MATCH_TYPE + - ANY_MATCH_TYPE + type: string + format: enum + namespaceKey: + type: string + UpdateVariantRequest: + required: + - key + type: object + properties: + id: + type: string + flagKey: + type: string + key: + type: string + name: + type: string + description: + type: string + attachment: + type: string + namespaceKey: + type: string + Variant: + type: object + properties: + id: + type: string + flagKey: + type: string + key: + type: string + name: + type: string + description: + type: string + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + attachment: + type: string + namespaceKey: + type: string + VariantEvaluationResponse: + type: object + properties: + match: + type: boolean + segmentKeys: + type: array + items: + type: string + reason: + enum: + - UNKNOWN_EVALUATION_REASON + - FLAG_DISABLED_EVALUATION_REASON + - MATCH_EVALUATION_REASON + - DEFAULT_EVALUATION_REASON + type: string + format: enum + variantKey: + type: string + variantAttachment: + type: string + requestId: + type: string + requestDurationMillis: + type: number + format: double + timestamp: + type: string + format: date-time + flagKey: + type: string + VerifyServiceAccountRequest: + type: object + properties: + serviceAccountToken: + type: string + VerifyServiceAccountResponse: + type: object + properties: + clientToken: + type: string + authentication: + $ref: '#/components/schemas/Authentication' + securitySchemes: + bearerAuth: + type: http + scheme: bearer + jwtAuth: + type: http + scheme: JWT +security: + - bearerAuth: [] +tags: + - name: AuthenticationMethodKubernetesService + - name: AuthenticationMethodOIDCService + - name: AuthenticationMethodTokenService + - name: AuthenticationService + - name: EvaluationService + - name: Flipt + - name: OFREPService diff --git a/src/OpenFeature.Contrib.Providers.Flipt/openapi.yml b/src/OpenFeature.Contrib.Providers.Flipt/openapi.yml deleted file mode 100644 index dbfa9d79..00000000 --- a/src/OpenFeature.Contrib.Providers.Flipt/openapi.yml +++ /dev/null @@ -1,2225 +0,0 @@ -openapi: 3.0.1 -info: - title: api - version: 1.46.0 -paths: - /evaluate/v1/boolean: - post: - operationId: EvaluationService.boolean - tags: - - EvaluationService - parameters: [] - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/BooleanEvaluationResponse" - security: &ref_0 - - BearerAuth: [] - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/EvaluationRequest" - /evaluate/v1/variant: - post: - operationId: EvaluationService.variant - tags: - - EvaluationService - parameters: [] - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/VariantEvaluationResponse" - security: *ref_0 - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/EvaluationRequest" - /evaluate/v1/batch: - post: - operationId: EvaluationService.batch - tags: - - EvaluationService - parameters: [] - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/BatchEvaluationResponse" - security: *ref_0 - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/BatchEvaluationRequest" - /auth/v1/method/kubernetes/serviceaccount: - post: - operationId: AuthMethodK8SService.verifyServiceAccount - tags: - - AuthMethodK8SService - parameters: [] - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/AuthenticationToken" - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - serviceAccountToken: - type: string - required: - - serviceAccountToken - /auth/v1/method/oidc/{provider}/authorize: - get: - operationId: AuthMethodOIDCService.authorizeURL - tags: - - AuthMethodOIDCService - parameters: - - name: provider - in: path - required: true - schema: - type: string - - name: state - in: query - required: true - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/AuthMethodOIDCAuthorizeURLResponse" - /auth/v1/method/oidc/{provider}/callback: - get: - operationId: AuthMethodOIDCService.callback - tags: - - AuthMethodOIDCService - parameters: - - name: provider - in: path - required: true - schema: - type: string - - name: code - in: query - required: true - schema: - type: string - - name: state - in: query - required: true - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/AuthMethodOIDCCallbackResponse" - /auth/v1/method/token: - post: - operationId: AuthMethodTokenService.createToken - tags: - - AuthMethodTokenService - parameters: [] - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/AuthenticationToken" - security: *ref_0 - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - name: - type: string - namespaceKey: - type: string - description: - type: string - expiresAt: - type: string - format: date-time - required: - - name - - description - /auth/v1/tokens: - get: - operationId: AuthService.listTokens - tags: - - AuthService - parameters: [] - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/AuthenticationList" - security: *ref_0 - /auth/v1/tokens/{id}: - get: - operationId: AuthService.getToken - tags: - - AuthService - parameters: - - name: id - in: path - required: true - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/Authentication" - security: *ref_0 - delete: - operationId: AuthService.deleteToken - tags: - - AuthService - parameters: - - name: id - in: path - required: true - schema: - type: string - responses: - "204": - description: "" - security: *ref_0 - /auth/v1/self: - get: - operationId: AuthService.getSelf - tags: - - AuthService - parameters: [] - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/Authentication" - security: *ref_0 - /auth/v1/self/expire: - put: - operationId: AuthService.expireSelf - tags: - - AuthService - parameters: [] - responses: - "204": - description: "" - security: *ref_0 - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - expiresAt: - type: string - format: date-time - /api/v1/namespaces/{namespaceKey}/segments/{segmentKey}/constraints: - post: - operationId: ConstraintsService.create - tags: - - ConstraintsService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: segmentKey - in: path - required: true - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/Constraint" - security: *ref_0 - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/ConstraintCreateRequest" - /api/v1/namespaces/{namespaceKey}/segments/{segmentKey}/constraints/{id}: - delete: - operationId: ConstraintsService.delete - tags: - - ConstraintsService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: segmentKey - in: path - required: true - schema: - type: string - - name: id - in: path - required: true - schema: - type: string - responses: - "204": - description: "" - security: *ref_0 - put: - operationId: ConstraintsService.update - tags: - - ConstraintsService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: segmentKey - in: path - required: true - schema: - type: string - - name: id - in: path - required: true - schema: - type: string - responses: - "204": - description: "" - security: *ref_0 - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/ConstraintUpdateRequest" - /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{ruleId}/distributions: - post: - operationId: DistributionsService.create - tags: - - DistributionsService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: flagKey - in: path - required: true - schema: - type: string - - name: ruleId - in: path - required: true - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/Distribution" - security: *ref_0 - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/DistributionCreateRequest" - /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{ruleId}/distributions/{id}: - delete: - operationId: DistributionsService.delete - tags: - - DistributionsService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: flagKey - in: path - required: true - schema: - type: string - - name: ruleId - in: path - required: true - schema: - type: string - - name: id - in: path - required: true - schema: - type: string - - name: variantId - in: query - required: true - schema: - type: string - responses: - "204": - description: "" - security: *ref_0 - put: - operationId: DistributionsService.update - tags: - - DistributionsService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: flagKey - in: path - required: true - schema: - type: string - - name: ruleId - in: path - required: true - schema: - type: string - - name: id - in: path - required: true - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/Distribution" - security: *ref_0 - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/DistributionUpdateRequest" - /api/v1/namespaces/{namespaceKey}/evaluate: - post: - operationId: EvaluateService.evaluate - tags: - - EvaluateService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/EvaluationResponse" - security: *ref_0 - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/EvaluationRequest" - /api/v1/namespaces/{namespaceKey}/batch-evaluate: - post: - operationId: EvaluateService.batchEvaluate - tags: - - EvaluateService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/BatchEvaluationResponse" - security: *ref_0 - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/BatchEvaluationRequest" - /api/v1/namespaces/{namespaceKey}/flags: - get: - operationId: FlagsService.list - tags: - - FlagsService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: limit - in: query - required: false - schema: - type: integer - - name: offset - in: query - required: false - schema: - type: integer - - name: pageToken - in: query - required: false - schema: - type: string - - name: reference - in: query - required: false - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/FlagList" - security: *ref_0 - post: - operationId: FlagsService.create - tags: - - FlagsService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/Flag" - security: *ref_0 - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/FlagCreateRequest" - /api/v1/namespaces/{namespaceKey}/flags/{key}: - get: - operationId: FlagsService.get - tags: - - FlagsService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: key - in: path - required: true - schema: - type: string - - name: reference - in: query - required: false - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/Flag" - security: *ref_0 - delete: - operationId: FlagsService.delete - tags: - - FlagsService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: key - in: path - required: true - schema: - type: string - responses: - "204": - description: "" - security: *ref_0 - put: - operationId: FlagsService.update - tags: - - FlagsService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: key - in: path - required: true - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/Flag" - security: *ref_0 - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/FlagUpdateRequest" - /api/v1/namespaces: - get: - operationId: NamespacesService.list - tags: - - NamespacesService - parameters: - - name: limit - in: query - required: false - schema: - type: integer - - name: offset - in: query - required: false - schema: - type: integer - - name: pageToken - in: query - required: false - schema: - type: string - - name: reference - in: query - required: false - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/NamespaceList" - security: *ref_0 - post: - operationId: NamespacesService.create - tags: - - NamespacesService - parameters: [] - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/Namespace" - security: *ref_0 - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/NamespaceCreateRequest" - /api/v1/namespaces/{key}: - get: - operationId: NamespacesService.get - tags: - - NamespacesService - parameters: - - name: key - in: path - required: true - schema: - type: string - - name: reference - in: query - required: false - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/Namespace" - security: *ref_0 - delete: - operationId: NamespacesService.delete - tags: - - NamespacesService - parameters: - - name: key - in: path - required: true - schema: - type: string - responses: - "204": - description: "" - security: *ref_0 - put: - operationId: NamespacesService.update - tags: - - NamespacesService - parameters: - - name: key - in: path - required: true - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/Namespace" - security: *ref_0 - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/NamespaceUpdateRequest" - /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts: - get: - operationId: RolloutsService.list - tags: - - RolloutsService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: flagKey - in: path - required: true - schema: - type: string - - name: limit - in: query - required: false - schema: - type: integer - - name: offset - in: query - required: false - schema: - type: integer - - name: pageToken - in: query - required: false - schema: - type: string - - name: reference - in: query - required: false - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/RolloutList" - security: *ref_0 - post: - operationId: RolloutsService.create - tags: - - RolloutsService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: flagKey - in: path - required: true - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/Rollout" - security: *ref_0 - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/RolloutCreateRequest" - /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts/order: - put: - operationId: RolloutsService.order - tags: - - RolloutsService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: flagKey - in: path - required: true - schema: - type: string - responses: - "204": - description: "" - security: *ref_0 - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/RolloutOrderRequest" - /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts/{id}: - get: - operationId: RolloutsService.get - tags: - - RolloutsService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: flagKey - in: path - required: true - schema: - type: string - - name: id - in: path - required: true - schema: - type: string - - name: reference - in: query - required: false - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/Rollout" - security: *ref_0 - delete: - operationId: RolloutsService.delete - tags: - - RolloutsService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: flagKey - in: path - required: true - schema: - type: string - - name: id - in: path - required: true - schema: - type: string - responses: - "204": - description: "" - security: *ref_0 - put: - operationId: RolloutsService.update - tags: - - RolloutsService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: flagKey - in: path - required: true - schema: - type: string - - name: id - in: path - required: true - schema: - type: string - responses: - "204": - description: "" - security: *ref_0 - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/RolloutUpdateRequest" - /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules: - get: - operationId: RulesService.list - tags: - - RulesService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: flagKey - in: path - required: true - schema: - type: string - - name: limit - in: query - required: false - schema: - type: integer - - name: offset - in: query - required: false - schema: - type: integer - - name: pageToken - in: query - required: false - schema: - type: string - - name: reference - in: query - required: false - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/RuleList" - security: *ref_0 - post: - operationId: RulesService.create - tags: - - RulesService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: flagKey - in: path - required: true - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/Rule" - security: *ref_0 - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/RuleCreateRequest" - /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/order: - put: - operationId: RulesService.order - tags: - - RulesService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: flagKey - in: path - required: true - schema: - type: string - responses: - "204": - description: "" - security: *ref_0 - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/RuleOrderRequest" - /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{id}: - get: - operationId: RulesService.get - tags: - - RulesService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: flagKey - in: path - required: true - schema: - type: string - - name: id - in: path - required: true - schema: - type: string - - name: reference - in: query - required: false - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/Rule" - security: *ref_0 - delete: - operationId: RulesService.delete - tags: - - RulesService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: flagKey - in: path - required: true - schema: - type: string - - name: id - in: path - required: true - schema: - type: string - responses: - "204": - description: "" - security: *ref_0 - put: - operationId: RulesService.update - tags: - - RulesService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: flagKey - in: path - required: true - schema: - type: string - - name: id - in: path - required: true - schema: - type: string - responses: - "204": - description: "" - security: *ref_0 - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/RuleUpdateRequest" - /api/v1/namespaces/{namespaceKey}/segments: - get: - operationId: SegmentsService.list - tags: - - SegmentsService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: limit - in: query - required: false - schema: - type: integer - - name: offset - in: query - required: false - schema: - type: integer - - name: pageToken - in: query - required: false - schema: - type: string - - name: reference - in: query - required: false - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/SegmentList" - security: *ref_0 - post: - operationId: SegmentsService.create - tags: - - SegmentsService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/Segment" - security: *ref_0 - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/SegmentCreateRequest" - /api/v1/namespaces/{namespaceKey}/segments/{key}: - get: - operationId: SegmentsService.get - tags: - - SegmentsService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: key - in: path - required: true - schema: - type: string - - name: reference - in: query - required: false - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/Segment" - security: *ref_0 - delete: - operationId: SegmentsService.delete - tags: - - SegmentsService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: key - in: path - required: true - schema: - type: string - responses: - "204": - description: "" - security: *ref_0 - put: - operationId: SegmentsService.update - tags: - - SegmentsService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: key - in: path - required: true - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/Segment" - security: *ref_0 - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/SegmentUpdateRequest" - /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/variants: - post: - operationId: VariantsService.create - tags: - - VariantsService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: flagKey - in: path - required: true - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/Variant" - security: *ref_0 - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/VariantCreateRequest" - /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/variants/{id}: - delete: - operationId: VariantsService.delete - tags: - - VariantsService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: flagKey - in: path - required: true - schema: - type: string - - name: id - in: path - required: true - schema: - type: string - responses: - "204": - description: "" - security: *ref_0 - put: - operationId: VariantsService.update - tags: - - VariantsService - parameters: - - name: namespaceKey - in: path - required: true - schema: - type: string - - name: flagKey - in: path - required: true - schema: - type: string - - name: id - in: path - required: true - schema: - type: string - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/Variant" - security: *ref_0 - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/VariantUpdateRequest" -components: - schemas: - EvaluationRequest: - type: object - properties: - requestId: - type: string - namespaceKey: - type: string - flagKey: - type: string - entityId: - type: string - context: - type: object - additionalProperties: - type: string - reference: - type: string - required: - - namespaceKey - - flagKey - - entityId - - context - EvaluationResponseType: - type: string - enum: - - VARIANT_EVALUATION_RESPONSE_TYPE - - BOOLEAN_EVALUATION_RESPONSE_TYPE - - ERROR_EVALUATION_RESPONSE_TYPE - EvaluationResponse: - type: object - properties: - type: - $ref: "#/components/schemas/EvaluationResponseType" - booleanResponse: - $ref: "#/components/schemas/BooleanEvaluationResponse" - variantResponse: - $ref: "#/components/schemas/VariantEvaluationResponse" - errorResponse: - $ref: "#/components/schemas/ErrorEvaluationResponse" - required: - - type - ErrorEvaluationResponse: - type: object - properties: - flagKey: - type: string - namespaceKey: - type: string - reason: - $ref: "#/components/schemas/ErrorEvaluationReason" - required: - - flagKey - - namespaceKey - - reason - BooleanEvaluationResponse: - type: object - properties: - requestId: - type: string - flagKey: - type: string - enabled: - type: boolean - timestamp: - type: string - format: date-time - requestDurationMillis: - type: number - format: double - reason: - $ref: "#/components/schemas/EvaluationReason" - required: - - requestId - - flagKey - - enabled - - timestamp - - requestDurationMillis - - reason - VariantEvaluationResponse: - type: object - properties: - requestId: - type: string - match: - type: boolean - flagKey: - type: string - segmentKeys: - type: array - items: - type: string - variantKey: - type: string - variantAttachment: - type: string - timestamp: - type: string - format: date-time - requestDurationMillis: - type: number - format: double - reason: - $ref: "#/components/schemas/EvaluationReason" - required: - - requestId - - match - - flagKey - - segmentKeys - - variantKey - - variantAttachment - - timestamp - - requestDurationMillis - - reason - EvaluationReason: - type: string - enum: - - UNKNOWN_EVALUATION_REASON - - FLAG_DISABLED_EVALUATION_REASON - - MATCH_EVALUATION_REASON - - DEFAULT_EVALUATION_REASON - ErrorEvaluationReason: - type: string - enum: - - UNKNOWN_ERROR_EVALUATION_REASON - - NOT_FOUND_ERROR_EVALUATION_REASON - BatchEvaluationRequest: - type: object - properties: - requestId: - type: string - requests: - type: array - items: - $ref: "#/components/schemas/EvaluationRequest" - reference: - type: string - required: - - requests - BatchEvaluationResponse: - type: object - properties: - requestId: - type: string - responses: - type: array - items: - $ref: "#/components/schemas/EvaluationResponse" - requestDurationMillis: - type: number - format: double - required: - - requestId - - responses - - requestDurationMillis - AuthMethodOIDCAuthorizeURLResponse: - type: object - properties: - authorizeUrl: - type: string - required: - - authorizeUrl - AuthMethodOIDCCallbackResponse: - type: object - properties: - authentication: - $ref: "#/components/schemas/Authentication" - required: - - authentication - AuthenticationMethod: - type: string - enum: - - METHOD_NONE - - METHOD_TOKEN - - METHOD_OIDC - - METHOD_KUBERNETES - - METHOD_JWT - description: The default is METHOD_NONE - Authentication: - type: object - properties: - id: - type: string - method: - $ref: "#/components/schemas/AuthenticationMethod" - createdAt: - type: string - format: date-time - updatedAt: - type: string - format: date-time - expiresAt: - type: string - format: date-time - metadata: - type: object - additionalProperties: - type: string - required: - - id - - method - - createdAt - - updatedAt - - metadata - AuthenticationList: - type: object - properties: - authentications: - type: array - items: - $ref: "#/components/schemas/Authentication" - nextPageToken: - type: string - required: - - authentications - - nextPageToken - AuthenticationToken: - type: object - properties: - clientToken: - type: string - authentication: - $ref: "#/components/schemas/Authentication" - required: - - clientToken - - authentication - CommonsPageable: - type: object - properties: - nextPageToken: - type: string - totalCount: - type: integer - ConstraintComparisonType: - type: string - enum: - - UNKNOWN_COMPARISON_TYPE - - STRING_COMPARISON_TYPE - - NUMBER_COMPARISON_TYPE - - BOOLEAN_COMPARISON_TYPE - - DATETIME_COMPARISON_TYPE - description: The default is UNKNOWN_COMPARISON_TYPE - Constraint: - type: object - properties: - id: - type: string - namespaceKey: - type: string - segmentKey: - type: string - type: - $ref: "#/components/schemas/ConstraintComparisonType" - property: - type: string - operator: - type: string - value: - type: string - description: - type: string - createdAt: - type: string - format: date-time - updatedAt: - type: string - format: date-time - required: - - id - - namespaceKey - - segmentKey - - type - - property - - operator - - value - - description - - createdAt - - updatedAt - ConstraintCreateRequest: - type: object - properties: - type: - $ref: "#/components/schemas/ConstraintComparisonType" - property: - type: string - operator: - type: string - value: - type: string - description: - type: string - required: - - type - - property - - operator - ConstraintUpdateRequest: - type: object - properties: - type: - $ref: "#/components/schemas/ConstraintComparisonType" - property: - type: string - operator: - type: string - value: - type: string - description: - type: string - required: - - type - - property - - operator - Distribution: - type: object - properties: - id: - type: string - ruleId: - type: string - variantId: - type: string - rollout: - type: number - format: double - createdAt: - type: string - format: date-time - updatedAt: - type: string - format: date-time - required: - - id - - ruleId - - variantId - - rollout - - createdAt - - updatedAt - DistributionCreateRequest: - type: object - properties: - variantId: - type: string - rollout: - type: number - format: double - required: - - variantId - - rollout - DistributionUpdateRequest: - type: object - properties: - variantId: - type: string - rollout: - type: number - format: double - required: - - variantId - - rollout - FlagList: - type: object - properties: - flags: - type: array - items: - $ref: "#/components/schemas/Flag" - nextPageToken: - type: string - totalCount: - type: integer - required: - - flags - - nextPageToken - - totalCount - Flag: - type: object - properties: - namespaceKey: - type: string - key: - type: string - name: - type: string - description: - type: string - enabled: - type: boolean - createdAt: - type: string - format: date-time - updatedAt: - type: string - format: date-time - variants: - type: array - items: - $ref: "#/components/schemas/Variant" - type: - $ref: "#/components/schemas/FlagType" - defaultVariant: - $ref: "#/components/schemas/Variant" - required: - - namespaceKey - - key - - name - - description - - enabled - - createdAt - - updatedAt - - variants - - type - FlagType: - type: string - enum: - - VARIANT_FLAG_TYPE - - BOOLEAN_FLAG_TYPE - FlagCreateRequest: - type: object - properties: - key: - type: string - name: - type: string - description: - type: string - enabled: - type: boolean - type: - $ref: "#/components/schemas/FlagType" - required: - - key - - name - - type - FlagUpdateRequest: - type: object - properties: - name: - type: string - description: - type: string - enabled: - type: boolean - defaultVariantId: - type: string - required: - - name - NamespaceList: - type: object - properties: - namespaces: - type: array - items: - $ref: "#/components/schemas/Namespace" - nextPageToken: - type: string - totalCount: - type: integer - required: - - namespaces - - nextPageToken - - totalCount - Namespace: - type: object - properties: - key: - type: string - name: - type: string - description: - type: string - protected: - type: boolean - createdAt: - type: string - format: date-time - updatedAt: - type: string - format: date-time - required: - - key - - name - - description - - protected - - createdAt - - updatedAt - NamespaceCreateRequest: - type: object - properties: - key: - type: string - name: - type: string - description: - type: string - required: - - key - - name - NamespaceUpdateRequest: - type: object - properties: - name: - type: string - description: - type: string - required: - - name - RolloutList: - type: object - properties: - rollouts: - type: array - items: - $ref: "#/components/schemas/Rollout" - nextPageToken: - type: string - totalCount: - type: integer - required: - - rollouts - - nextPageToken - - totalCount - Rollout: - type: object - properties: - id: - type: string - namespaceKey: - type: string - flagKey: - type: string - type: - $ref: "#/components/schemas/RolloutType" - rank: - type: integer - description: - type: string - createdAt: - type: string - format: date-time - updatedAt: - type: string - format: date-time - segment: - $ref: "#/components/schemas/RolloutSegment" - threshold: - $ref: "#/components/schemas/RolloutThreshold" - required: - - id - - namespaceKey - - flagKey - - type - - rank - - description - - createdAt - - updatedAt - RolloutSegmentOperator: - type: string - enum: - - OR_SEGMENT_OPERATOR - - AND_SEGMENT_OPERATOR - RolloutType: - type: string - enum: - - UNKNOWN_ROLLOUT_TYPE - - SEGMENT_ROLLOUT_TYPE - - THRESHOLD_ROLLOUT_TYPE - RolloutSegment: - type: object - properties: - segmentKey: - type: string - segmentKeys: - type: array - items: - type: string - segmentOperator: - $ref: "#/components/schemas/RolloutSegmentOperator" - value: - type: boolean - required: - - segmentKey - - value - RolloutThreshold: - type: object - properties: - percentage: - type: number - format: double - value: - type: boolean - required: - - percentage - - value - RolloutCreateRequest: - type: object - properties: - rank: - type: integer - description: - type: string - segment: - $ref: "#/components/schemas/RolloutSegment" - threshold: - $ref: "#/components/schemas/RolloutThreshold" - required: - - rank - RolloutUpdateRequest: - type: object - properties: - description: - type: string - segment: - $ref: "#/components/schemas/RolloutSegment" - threshold: - $ref: "#/components/schemas/RolloutThreshold" - RolloutOrderRequest: - type: object - properties: - rolloutIds: - type: array - items: - type: string - required: - - rolloutIds - RuleList: - type: object - properties: - rules: - type: array - items: - $ref: "#/components/schemas/Rule" - nextPageToken: - type: string - totalCount: - type: integer - required: - - rules - - nextPageToken - - totalCount - RuleSegmentOperator: - type: string - enum: - - OR_SEGMENT_OPERATOR - - AND_SEGMENT_OPERATOR - Rule: - type: object - properties: - id: - type: string - namespaceKey: - type: string - flagKey: - type: string - segmentKey: - type: string - segmentKeys: - type: array - items: - type: string - segmentOperator: - $ref: "#/components/schemas/RuleSegmentOperator" - distributions: - type: array - items: - $ref: "#/components/schemas/Distribution" - rank: - type: integer - createdAt: - type: string - format: date-time - updatedAt: - type: string - format: date-time - required: - - id - - namespaceKey - - flagKey - - segmentKey - - segmentOperator - - distributions - - rank - - createdAt - - updatedAt - RuleCreateRequest: - type: object - properties: - segmentKey: - type: string - segmentKeys: - type: array - items: - type: string - segmentOperator: - $ref: "#/components/schemas/RuleSegmentOperator" - rank: - type: integer - required: - - segmentKey - - rank - RuleOrderRequest: - type: object - properties: - ruleIds: - type: array - items: - type: string - required: - - ruleIds - RuleUpdateRequest: - type: object - properties: - segmentKey: - type: string - segmentKeys: - type: array - items: - type: string - segmentOperator: - $ref: "#/components/schemas/RuleSegmentOperator" - required: - - segmentKey - SegmentList: - type: object - properties: - segments: - type: array - items: - $ref: "#/components/schemas/Segment" - nextPageToken: - type: string - totalCount: - type: integer - required: - - segments - - nextPageToken - - totalCount - Segment: - type: object - properties: - namespaceKey: - type: string - key: - type: string - name: - type: string - description: - type: string - createdAt: - type: string - format: date-time - updatedAt: - type: string - format: date-time - constraints: - type: array - items: - $ref: "#/components/schemas/Constraint" - matchType: - $ref: "#/components/schemas/SegmentMatchType" - required: - - namespaceKey - - key - - name - - description - - createdAt - - updatedAt - - constraints - - matchType - SegmentMatchType: - type: string - enum: - - ALL_MATCH_TYPE - - ANY_MATCH_TYPE - SegmentCreateRequest: - type: object - properties: - key: - type: string - name: - type: string - description: - type: string - matchType: - $ref: "#/components/schemas/SegmentMatchType" - required: - - key - - name - - description - - matchType - SegmentUpdateRequest: - type: object - properties: - name: - type: string - description: - type: string - matchType: - $ref: "#/components/schemas/SegmentMatchType" - required: - - name - - description - - matchType - Variant: - type: object - properties: - id: - type: string - namespaceKey: - type: string - flagKey: - type: string - key: - type: string - name: - type: string - description: - type: string - createdAt: - type: string - format: date-time - updatedAt: - type: string - format: date-time - attachment: - type: string - required: - - id - - namespaceKey - - flagKey - - key - - name - - description - - createdAt - - updatedAt - - attachment - VariantCreateRequest: - type: object - properties: - key: - type: string - name: - type: string - description: - type: string - attachment: - type: string - required: - - key - VariantUpdateRequest: - type: object - properties: - key: - type: string - name: - type: string - description: - type: string - attachment: - type: string - required: - - key - securitySchemes: - BearerAuth: - type: http - scheme: bearer -servers: - - url: http://localhost:8080 diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs index 7ff001c9..57146745 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs @@ -23,7 +23,7 @@ public void CreateFliptProvider_ShouldReturnFliptProvider() [Fact] public void CreateFliptProvider_GivenEmptyUrl_ShouldThrowInvalidOperationException() { - var act = void() => new FliptProvider(""); + var act = void () => new FliptProvider(""); act.Should().Throw(); } @@ -44,7 +44,7 @@ public async Task SegmentKeys = ["segment1"], VariantAttachment = "", Match = true, - Reason = EvaluationReason.MATCH_EVALUATION_REASON + Reason = VariantEvaluationResponseReason.MATCH_EVALUATION_REASON }); var provider = new FliptProvider(new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object)); @@ -128,7 +128,7 @@ public async Task ResolveBooleanValueAsync_WhenCalled_ShouldCallCorrectMethodFro SegmentKeys = ["segment1"], VariantAttachment = "", Match = true, - Reason = EvaluationReason.MATCH_EVALUATION_REASON + Reason = VariantEvaluationResponseReason.MATCH_EVALUATION_REASON }); mockFliptClientWrapper.Setup(fcw => fcw.EvaluateBooleanAsync(It.IsAny())) @@ -138,7 +138,7 @@ public async Task ResolveBooleanValueAsync_WhenCalled_ShouldCallCorrectMethodFro RequestId = Guid.NewGuid() .ToString(), Enabled = true, - Reason = EvaluationReason.MATCH_EVALUATION_REASON + Reason = BooleanEvaluationResponseReason.MATCH_EVALUATION_REASON }); return (new FliptProvider(new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object)), diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs index d158d9e7..13942914 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs @@ -115,7 +115,7 @@ public async Task EvaluateAsync_GivenExistingVariantFlagWhichIsNotAnObject_Shoul SegmentKeys = ["segment1"], VariantAttachment = variantAttachment, Match = true, - Reason = EvaluationReason.MATCH_EVALUATION_REASON + Reason = VariantEvaluationResponseReason.MATCH_EVALUATION_REASON }); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); @@ -133,11 +133,11 @@ public async Task EvaluateAsync_GivenExistingVariantFlagAndWithAnObject_ShouldRe const string flagKey = "variant-flag"; const string variantKey = "variant-A"; const string valueFromSrc = """ - { - "name": "Mr. Robinson", - "age": 12, - } - """; + { + "name": "Mr. Robinson", + "age": 12, + } + """; var expectedValue = new Value(new Structure(new Dictionary { { "name", new Value("Mr. Robinson") }, { "age", new Value(12) } @@ -153,7 +153,7 @@ public async Task EvaluateAsync_GivenExistingVariantFlagAndWithAnObject_ShouldRe SegmentKeys = ["segment1"], VariantAttachment = valueFromSrc, Match = true, - Reason = EvaluationReason.MATCH_EVALUATION_REASON + Reason = VariantEvaluationResponseReason.MATCH_EVALUATION_REASON }); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); From 66331328f49772f39a02edd72879cdb543d8593b Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Fri, 4 Oct 2024 09:17:16 +0200 Subject: [PATCH 29/47] Update readme instructions Signed-off-by: Andrei de la Cruz --- src/OpenFeature.Contrib.Providers.Flipt/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/OpenFeature.Contrib.Providers.Flipt/README.md b/src/OpenFeature.Contrib.Providers.Flipt/README.md index cfe49768..3f74fbad 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/README.md +++ b/src/OpenFeature.Contrib.Providers.Flipt/README.md @@ -48,7 +48,8 @@ packet add OpenFeature.Contrib.Providers.Flipt ## Using the Flipt Provider with the OpenFeature SDK -To create a Flipt provider you should define provider and pass in as parameters. +To create a Flipt provider you should define provider and pass in the instance `url` (required), `defaultNamespace` and +`token`. ```csharp using OpenFeature.Contrib.Providers.Flipt; From d8c4e85b789f598db1c558d134585afd66c1c8b5 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Fri, 4 Oct 2024 11:57:14 +0200 Subject: [PATCH 30/47] reverted nuget.config changes, fix linting spacing issue caused by formatter Signed-off-by: Andrei de la Cruz --- nuget.config | 2 +- .../FlipExtensionsTest.cs | 71 +++++++++---------- .../FliptProviderTest.cs | 2 +- .../FliptToOpenFeatureConverterTest.cs | 4 +- 4 files changed, 38 insertions(+), 41 deletions(-) diff --git a/nuget.config b/nuget.config index 06acf1e4..c5f009d2 100644 --- a/nuget.config +++ b/nuget.config @@ -4,7 +4,7 @@ - + diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs index 57aa31ae..21e9ec1d 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs @@ -100,37 +100,34 @@ public void ToStringDictionary_WithContextAndMixedValueTypes_ShouldReturnADictio [Fact] public void ToStringDictionary_WithContextWithListAndNestedList_ShouldReturnADictionaryWithSerializedValues() { - var testStructure = new Structure(new Dictionary - { - { - "config2", - new Value([ - new Value([new Value("element1-1"), new Value("element1-2")]), new Value("element2"), - new Value("element3") - ]) - }, - { "config3", new Value(DateTime.Now) } -}); + var sampleDictionary = new Dictionary(); + sampleDictionary["config2"] = new Value([ + new Value([new Value("element1-1"), new Value("element1-2")]), new Value("element2"), + new Value("element3") + ]); + sampleDictionary["config3"] = new Value(DateTime.Now); + + var testStructure = new Structure(sampleDictionary); -var evaluationContext = EvaluationContext.Builder() - .SetTargetingKey(Guid.NewGuid().ToString()) - .Set("config", testStructure) - .Build(); -var result = evaluationContext.ToStringDictionary(); + var evaluationContext = EvaluationContext.Builder() + .SetTargetingKey(Guid.NewGuid().ToString()) + .Set("config", testStructure) + .Build(); + var result = evaluationContext.ToStringDictionary(); -result.Should().NotBeNull(); -result.Should().NotBeEmpty(); -result.Keys.Should().Contain("config"); + result.Should().NotBeNull(); + result.Should().NotBeEmpty(); + result.Keys.Should().Contain("config"); -var deserialized = JsonSerializer.Deserialize(result["config"], - JsonConverterExtensions.DefaultSerializerSettings); -deserialized.Should().BeEquivalentTo(testStructure); + var deserialized = JsonSerializer.Deserialize(result["config"], + JsonConverterExtensions.DefaultSerializerSettings); + deserialized.Should().BeEquivalentTo(testStructure); } [Fact] -public void ToStringDictionary_WithContextWithNestedStructure_ShouldReturnADictionaryWithSerializedValues() -{ - var testStructure = new Structure(new Dictionary + public void ToStringDictionary_WithContextWithNestedStructure_ShouldReturnADictionaryWithSerializedValues() + { + var testStructure = new Structure(new Dictionary { { "config-value-struct", new Value(new Structure(new Dictionary @@ -141,18 +138,18 @@ public void ToStringDictionary_WithContextWithNestedStructure_ShouldReturnADicti { "config-value-value", new Value(new Value(DateTime.Now)) } }); - var evaluationContext = EvaluationContext.Builder() - .SetTargetingKey(Guid.NewGuid().ToString()) - .Set("config", testStructure) - .Build(); - var result = evaluationContext.ToStringDictionary(); + var evaluationContext = EvaluationContext.Builder() + .SetTargetingKey(Guid.NewGuid().ToString()) + .Set("config", testStructure) + .Build(); + var result = evaluationContext.ToStringDictionary(); - result.Should().NotBeNull(); - result.Should().NotBeEmpty(); - result.Keys.Should().Contain("config"); + result.Should().NotBeNull(); + result.Should().NotBeEmpty(); + result.Keys.Should().Contain("config"); - var deserialized = JsonSerializer.Deserialize(result["config"], - JsonConverterExtensions.DefaultSerializerSettings); - deserialized.Should().BeEquivalentTo(testStructure); -} + var deserialized = JsonSerializer.Deserialize(result["config"], + JsonConverterExtensions.DefaultSerializerSettings); + deserialized.Should().BeEquivalentTo(testStructure); + } } \ No newline at end of file diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs index 57146745..e895c501 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs @@ -23,7 +23,7 @@ public void CreateFliptProvider_ShouldReturnFliptProvider() [Fact] public void CreateFliptProvider_GivenEmptyUrl_ShouldThrowInvalidOperationException() { - var act = void () => new FliptProvider(""); + var act = void() => new FliptProvider(""); act.Should().Throw(); } diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs index 13942914..3e06bad2 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs @@ -134,10 +134,10 @@ public async Task EvaluateAsync_GivenExistingVariantFlagAndWithAnObject_ShouldRe const string variantKey = "variant-A"; const string valueFromSrc = """ { - "name": "Mr. Robinson", + "name": "Mr. Robinson", "age": 12, } - """; + """; var expectedValue = new Value(new Structure(new Dictionary { { "name", new Value("Mr. Robinson") }, { "age", new Value(12) } From a5ed946d780be8679085239150f201903cdbd394 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Tue, 8 Oct 2024 16:04:11 +0200 Subject: [PATCH 31/47] FliptProvider: Updated to throw exceptions instead of handling them and returning ResolutionDetails Signed-off-by: Andrei de la Cruz --- .../FliptToOpenFeatureConverter.cs | 142 +++++++++--------- .../FliptProviderTest.cs | 35 ++--- .../FliptToOpenFeatureConverterTest.cs | 50 +++--- 3 files changed, 102 insertions(+), 125 deletions(-) diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs index 6a78a2cb..8c558d26 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs @@ -1,11 +1,12 @@ using System; -using System.Net; +using System.Net.Http; using System.Text.Json; using System.Threading.Tasks; using Flipt.Rest; using OpenFeature.Constant; using OpenFeature.Contrib.Providers.Flipt.ClientWrapper; using OpenFeature.Contrib.Providers.Flipt.Converters; +using OpenFeature.Error; using OpenFeature.Model; namespace OpenFeature.Contrib.Providers.Flipt; @@ -28,99 +29,90 @@ public FliptToOpenFeatureConverter(string fliptUrl, string clientToken = "", int timeoutInSeconds = 30) : this(new FliptClientWrapper(fliptUrl, clientToken, timeoutInSeconds), namespaceKey) -{ -} - -/// -public async Task> EvaluateAsync(string flagKey, T defaultValue, - EvaluationContext context = null) -{ - var evaluationRequest = new EvaluationRequest { - NamespaceKey = namespaceKey, - FlagKey = flagKey, - EntityId = context?.TargetingKey ?? "", - Context = context.ToStringDictionary() - }; + } - try + /// + public async Task> EvaluateAsync(string flagKey, T defaultValue, + EvaluationContext context = null) { - var evaluationResponse = await fliptClientWrapper.EvaluateVariantAsync(evaluationRequest); - - if (evaluationResponse.Reason == VariantEvaluationResponseReason.FLAG_DISABLED_EVALUATION_REASON) - return new ResolutionDetails(flagKey, defaultValue, ErrorType.None, - Reason.Disabled); + var evaluationRequest = new EvaluationRequest + { + NamespaceKey = namespaceKey, + FlagKey = flagKey, + EntityId = context?.TargetingKey ?? "", + Context = context.ToStringDictionary() + }; - if (!evaluationResponse.Match) - return new ResolutionDetails(flagKey, defaultValue, ErrorType.None, - Reason.Default); try { - if (string.IsNullOrEmpty(evaluationResponse.VariantAttachment)) + var evaluationResponse = await fliptClientWrapper.EvaluateVariantAsync(evaluationRequest); + + if (evaluationResponse.Reason == VariantEvaluationResponseReason.FLAG_DISABLED_EVALUATION_REASON) + return new ResolutionDetails(flagKey, defaultValue, ErrorType.None, + Reason.Disabled); + + if (!evaluationResponse.Match) + return new ResolutionDetails(flagKey, defaultValue, ErrorType.None, + Reason.Default); + try { - var convertedValue = (T)Convert.ChangeType(evaluationResponse.VariantKey, typeof(T)); - return new ResolutionDetails(flagKey, - convertedValue, ErrorType.None, - Reason.TargetingMatch, evaluationResponse.VariantKey); - } + if (string.IsNullOrEmpty(evaluationResponse.VariantAttachment)) + { + var convertedValue = (T)Convert.ChangeType(evaluationResponse.VariantKey, typeof(T)); + return new ResolutionDetails(flagKey, + convertedValue, ErrorType.None, + Reason.TargetingMatch, evaluationResponse.VariantKey); + } - var deserializedValueObj = JsonSerializer.Deserialize(evaluationResponse.VariantAttachment, - JsonConverterExtensions.DefaultSerializerSettings); + var deserializedValueObj = JsonSerializer.Deserialize(evaluationResponse.VariantAttachment, + JsonConverterExtensions.DefaultSerializerSettings); - return new ResolutionDetails(flagKey, - (T)Convert.ChangeType(deserializedValueObj, typeof(T)), - ErrorType.None, Reason.TargetingMatch, evaluationResponse.VariantKey); + return new ResolutionDetails(flagKey, + (T)Convert.ChangeType(deserializedValueObj, typeof(T)), + ErrorType.None, Reason.TargetingMatch, evaluationResponse.VariantKey); + } + catch (Exception ex) + { + if (ex is InvalidCastException or FormatException) + throw new TypeMismatchException(ex.Message, ex); + } } - catch (Exception ex) + catch (FliptRestException ex) { - if (ex is InvalidCastException or FormatException) - return new ResolutionDetails(flagKey, defaultValue, ErrorType.TypeMismatch, Reason.Error); + throw HttpRequestExceptionFromFliptRestException(ex); } - } - catch (FliptRestException ex) - { - return ResolutionDetailFromFliptRestException(ex, flagKey, defaultValue); - } - return new ResolutionDetails(flagKey, defaultValue, ErrorType.General, Reason.Unknown); -} + return new ResolutionDetails(flagKey, defaultValue, ErrorType.General, Reason.Unknown); + } -/// -public async Task> EvaluateBooleanAsync(string flagKey, bool defaultValue, - EvaluationContext context = null) -{ - try + /// + public async Task> EvaluateBooleanAsync(string flagKey, bool defaultValue, + EvaluationContext context = null) { - var evaluationRequest = new EvaluationRequest + try { - NamespaceKey = namespaceKey, - FlagKey = flagKey, - EntityId = context?.TargetingKey ?? "", - Context = context.ToStringDictionary() - }; - var boolEvaluationResponse = await fliptClientWrapper.EvaluateBooleanAsync(evaluationRequest); - return new ResolutionDetails(flagKey, boolEvaluationResponse.Enabled, ErrorType.None, - Reason.TargetingMatch); - } - catch (FliptRestException ex) - { - return ResolutionDetailFromFliptRestException(ex, flagKey, defaultValue); + var evaluationRequest = new EvaluationRequest + { + NamespaceKey = namespaceKey, + FlagKey = flagKey, + EntityId = context?.TargetingKey ?? "", + Context = context.ToStringDictionary() + }; + var boolEvaluationResponse = await fliptClientWrapper.EvaluateBooleanAsync(evaluationRequest); + return new ResolutionDetails(flagKey, boolEvaluationResponse.Enabled, ErrorType.None, + Reason.TargetingMatch); + } + catch (FliptRestException ex) + { + throw HttpRequestExceptionFromFliptRestException(ex); + } } -} -private static ResolutionDetails ResolutionDetailFromFliptRestException(FliptRestException e, string flagKey, - T defaultValue) -{ - var error = (HttpStatusCode)e.StatusCode switch + private static Exception HttpRequestExceptionFromFliptRestException(FliptRestException e) { - HttpStatusCode.NotFound => ErrorType.FlagNotFound, - HttpStatusCode.BadRequest => ErrorType.TypeMismatch, - HttpStatusCode.Forbidden => ErrorType.ProviderNotReady, - HttpStatusCode.InternalServerError => ErrorType.ProviderNotReady, - _ => ErrorType.General - }; - return new ResolutionDetails(flagKey, defaultValue, error, errorMessage: e.Message, reason: Reason.Error); -} + return new HttpRequestException(e.Message, e); + } } /// diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs index e895c501..ee5d1d46 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs @@ -1,8 +1,8 @@ using Flipt.Rest; using FluentAssertions; using Moq; -using OpenFeature.Constant; using OpenFeature.Contrib.Providers.Flipt.ClientWrapper; +using OpenFeature.Error; using OpenFeature.Model; using Xunit; @@ -23,7 +23,7 @@ public void CreateFliptProvider_ShouldReturnFliptProvider() [Fact] public void CreateFliptProvider_GivenEmptyUrl_ShouldThrowInvalidOperationException() { - var act = void() => new FliptProvider(""); + var act = void () => new FliptProvider(""); act.Should().Throw(); } @@ -49,20 +49,9 @@ public async Task var provider = new FliptProvider(new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object)); - var doubleResolution = await provider.ResolveDoubleValueAsync(flagKey, 0.0); - doubleResolution.FlagKey.Should().Be(flagKey); - doubleResolution.Value.Should().Be(0.0); - doubleResolution.ErrorType.Should().Be(ErrorType.TypeMismatch); - - var integerResolution = await provider.ResolveIntegerValueAsync(flagKey, 0); - integerResolution.FlagKey.Should().Be(flagKey); - integerResolution.Value.Should().Be(0); - integerResolution.ErrorType.Should().Be(ErrorType.TypeMismatch); - - var valueResolution = await provider.ResolveStructureValueAsync(flagKey, new Value()); - valueResolution.FlagKey.Should().Be(flagKey); - valueResolution.Value.Should().BeEquivalentTo(new Value()); - valueResolution.ErrorType.Should().Be(ErrorType.TypeMismatch); + var resolution = async Task> () => + await provider.ResolveDoubleValueAsync(flagKey, 0.0); + await resolution.Should().ThrowAsync(); } [Fact] @@ -79,7 +68,7 @@ public async Task ResolveStringValueAsync_WhenCalled_ShouldCallCorrectMethodFrom public async Task ResolveDoubleValueAsync_WhenCalled_ShouldCallCorrectMethodFromFliptClientWrapper() { const string flagKey = "feature-flag-key"; - var (provider, mockFliptClientWrapper) = GenerateFliptProviderWithMockedDependencies(flagKey); + var (provider, mockFliptClientWrapper) = GenerateFliptProviderWithMockedDependencies(flagKey, "0.0"); await provider.ResolveDoubleValueAsync(flagKey, 0.0); mockFliptClientWrapper.Verify( fcw => fcw.EvaluateVariantAsync(It.Is(er => er.FlagKey == flagKey)), Times.Once); @@ -89,7 +78,7 @@ public async Task ResolveDoubleValueAsync_WhenCalled_ShouldCallCorrectMethodFrom public async Task ResolveIntegerValueAsync_WhenCalled_ShouldCallCorrectMethodFromFliptClientWrapper() { const string flagKey = "feature-flag-key"; - var (provider, mockFliptClientWrapper) = GenerateFliptProviderWithMockedDependencies(flagKey); + var (provider, mockFliptClientWrapper) = GenerateFliptProviderWithMockedDependencies(flagKey, "0"); await provider.ResolveIntegerValueAsync(flagKey, 0); mockFliptClientWrapper.Verify( fcw => fcw.EvaluateVariantAsync(It.Is(er => er.FlagKey == flagKey)), Times.Once); @@ -99,7 +88,8 @@ public async Task ResolveIntegerValueAsync_WhenCalled_ShouldCallCorrectMethodFro public async Task ResolveStructureValueAsync_WhenCalled_ShouldCallCorrectMethodFromFliptClientWrapper() { const string flagKey = "feature-flag-key"; - var (provider, mockFliptClientWrapper) = GenerateFliptProviderWithMockedDependencies(flagKey); + var (provider, mockFliptClientWrapper) = + GenerateFliptProviderWithMockedDependencies(flagKey, new Value().AsString!); await provider.ResolveStructureValueAsync(flagKey, new Value()); mockFliptClientWrapper.Verify( fcw => fcw.EvaluateVariantAsync(It.Is(er => er.FlagKey == flagKey)), Times.Once); @@ -109,20 +99,21 @@ public async Task ResolveStructureValueAsync_WhenCalled_ShouldCallCorrectMethodF public async Task ResolveBooleanValueAsync_WhenCalled_ShouldCallCorrectMethodFromFliptClientWrapper() { const string flagKey = "feature-flag-key"; - var (provider, mockFliptClientWrapper) = GenerateFliptProviderWithMockedDependencies(flagKey); + var (provider, mockFliptClientWrapper) = GenerateFliptProviderWithMockedDependencies(flagKey, "true"); await provider.ResolveBooleanValueAsync(flagKey, false); mockFliptClientWrapper.Verify( fcw => fcw.EvaluateBooleanAsync(It.Is(er => er.FlagKey == flagKey)), Times.Once); } - private (FliptProvider, Mock) GenerateFliptProviderWithMockedDependencies(string flagKey) + private static (FliptProvider, Mock) GenerateFliptProviderWithMockedDependencies( + string flagKey, string variantKey = "variant-key") { var mockFliptClientWrapper = new Mock(); mockFliptClientWrapper.Setup(fcw => fcw.EvaluateVariantAsync(It.IsAny())) .ReturnsAsync(new VariantEvaluationResponse { FlagKey = flagKey, - VariantKey = "variant-key", + VariantKey = variantKey, RequestId = Guid.NewGuid() .ToString(), SegmentKeys = ["segment1"], diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs index 3e06bad2..d4d23e5c 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs @@ -27,10 +27,10 @@ public async Task EvaluateBooleanAsync_GivenHttpRequestException_ShouldHandleHtt .ThrowsAsync(new FliptRestException("", (int)thrownStatusCode, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); - var resolution = await fliptToOpenFeature.EvaluateBooleanAsync("flagKey", fallbackValue); - resolution.Value.Should().Be(fallbackValue); - resolution.ErrorType.Should().Be(expectedOpenFeatureErrorType); - resolution.Reason.Should().Be(Reason.Error); + var resolution = async Task> () => + await fliptToOpenFeature.EvaluateBooleanAsync("flagKey", fallbackValue); + + await resolution.Should().ThrowAsync(); } [Theory] @@ -67,12 +67,10 @@ public async Task EvaluateBooleanAsync_GivenNonExistentFlag_ShouldReturnDefaultV .ThrowsAsync(new FliptRestException("", (int)HttpStatusCode.NotFound, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); - var resolution = await fliptToOpenFeature.EvaluateBooleanAsync("show-feature", fallBackValue); + var resolution = async Task> () => + await fliptToOpenFeature.EvaluateBooleanAsync("flagKey", fallBackValue); - resolution.FlagKey.Should().Be(flagKey); - resolution.Value.Should().Be(fallBackValue); - resolution.ErrorType.Should().Be(ErrorType.FlagNotFound); - resolution.Reason.Should().Be(Reason.Error); + await resolution.Should().ThrowAsync(); } // EvaluateAsync Tests @@ -92,10 +90,10 @@ public async Task EvaluateAsync_GivenHttpRequestException_ShouldHandleHttpReques .ThrowsAsync(new FliptRestException("", (int)thrownStatusCode, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); - var resolution = await fliptToOpenFeature.EvaluateAsync("flagKey", fallbackValue); - resolution.Value.Should().Be(fallbackValue); - resolution.ErrorType.Should().Be(expectedOpenFeatureErrorType); - resolution.Reason.Should().Be(Reason.Error); + var resolution = async Task> () => + await fliptToOpenFeature.EvaluateAsync("flagKey", fallbackValue); + + await resolution.Should().ThrowAsync(); } [Theory] @@ -133,11 +131,11 @@ public async Task EvaluateAsync_GivenExistingVariantFlagAndWithAnObject_ShouldRe const string flagKey = "variant-flag"; const string variantKey = "variant-A"; const string valueFromSrc = """ - { - "name": "Mr. Robinson", - "age": 12, - } - """; + { + "name": "Mr. Robinson", + "age": 12, + } + """; var expectedValue = new Value(new Structure(new Dictionary { { "name", new Value("Mr. Robinson") }, { "age", new Value(12) } @@ -178,12 +176,10 @@ public async Task .ThrowsAsync(new FliptRestException("", (int)HttpStatusCode.NotFound, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); - var resolution = await fliptToOpenFeature.EvaluateAsync("non-existent-flag", fallbackValue); + var resolution = async Task> () => + await fliptToOpenFeature.EvaluateAsync("non-existent-flag", fallbackValue); - resolution.FlagKey.Should().Be("non-existent-flag"); - resolution.Variant.Should().BeNull(); - resolution.Value.Should().BeEquivalentTo(fallbackValue); - resolution.ErrorType.Should().Be(ErrorType.FlagNotFound); + await resolution.Should().ThrowAsync(); } @@ -197,11 +193,9 @@ public async Task .ThrowsAsync(new FliptRestException("", (int)HttpStatusCode.NotFound, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); - var resolution = await fliptToOpenFeature.EvaluateAsync("non-existent-flag", fallbackValue); + var resolution = async Task> () => + await fliptToOpenFeature.EvaluateAsync("non-existent-flag", fallbackValue); - resolution.FlagKey.Should().Be("non-existent-flag"); - resolution.Variant.Should().BeNull(); - resolution.Value.Should().BeEquivalentTo(fallbackValue); - resolution.ErrorType.Should().Be(ErrorType.FlagNotFound); + await resolution.Should().ThrowAsync(); } } \ No newline at end of file From 81b51628f56e4b70f09ac07ae3a29f983fd9a159 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Tue, 8 Oct 2024 17:06:08 +0200 Subject: [PATCH 32/47] FliptProvider: Moved client class generation and referencing in buildtime, kept openapi.yaml in the solution Signed-off-by: Andrei de la Cruz --- .../Flipt.Rest.Client.cs | 6796 ----------------- ...OpenFeature.Contrib.Providers.Flipt.csproj | 12 + 2 files changed, 12 insertions(+), 6796 deletions(-) delete mode 100644 src/OpenFeature.Contrib.Providers.Flipt/Flipt.Rest.Client.cs diff --git a/src/OpenFeature.Contrib.Providers.Flipt/Flipt.Rest.Client.cs b/src/OpenFeature.Contrib.Providers.Flipt/Flipt.Rest.Client.cs deleted file mode 100644 index 3f7f5057..00000000 --- a/src/OpenFeature.Contrib.Providers.Flipt/Flipt.Rest.Client.cs +++ /dev/null @@ -1,6796 +0,0 @@ -//---------------------- -// -// Generated using the NSwag toolchain v14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) -// -//---------------------- - -#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended." -#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." -#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?' -#pragma warning disable 612 // Disable "CS0612 '...' is obsolete" -#pragma warning disable 649 // Disable "CS0649 Field is never assigned to, and will always have its default value null" -#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ... -#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..." -#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'" -#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant" -#pragma warning disable 8603 // Disable "CS8603 Possible null reference return" -#pragma warning disable 8604 // Disable "CS8604 Possible null reference argument for parameter" -#pragma warning disable 8625 // Disable "CS8625 Cannot convert null literal to non-nullable reference type" -#pragma warning disable 8765 // Disable "CS8765 Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes)." - -namespace Flipt.Rest -{ - using System = global::System; - - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial interface IFliptRestClient - { - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesGetAsync(int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesPostAsync(CreateNamespaceRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesGetAsync(string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesPutAsync(string key, UpdateNamespaceRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesDeleteAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsGetAsync(string namespaceKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsPostAsync(string namespaceKey, CreateFlagRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsGetAsync(string namespaceKey, string flagKey, int? limit = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsPostAsync(string namespaceKey, string flagKey, CreateRolloutRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsOrderAsync(string namespaceKey, string flagKey, OrderRolloutsRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsGetAsync(string namespaceKey, string flagKey, string id, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsPutAsync(string namespaceKey, string flagKey, string id, UpdateRolloutRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesGetAsync(string namespaceKey, string flagKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesPostAsync(string namespaceKey, string flagKey, CreateRuleRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesOrderAsync(string namespaceKey, string flagKey, OrderRulesRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesGetAsync(string namespaceKey, string flagKey, string id, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesPutAsync(string namespaceKey, string flagKey, string id, UpdateRuleRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsPostAsync(string namespaceKey, string flagKey, string ruleId, CreateDistributionRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsPutAsync(string namespaceKey, string flagKey, string ruleId, string id, UpdateDistributionRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsDeleteAsync(string namespaceKey, string flagKey, string ruleId, string id, string variantId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsPostAsync(string namespaceKey, string flagKey, CreateVariantRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsPutAsync(string namespaceKey, string flagKey, string id, UpdateVariantRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsGetAsync(string namespaceKey, string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsPutAsync(string namespaceKey, string key, UpdateFlagRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesFlagsDeleteAsync(string namespaceKey, string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesSegmentsGetAsync(string namespaceKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesSegmentsPostAsync(string namespaceKey, CreateSegmentRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesSegmentsGetAsync(string namespaceKey, string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesSegmentsPutAsync(string namespaceKey, string key, UpdateSegmentRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesSegmentsDeleteAsync(string namespaceKey, string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsPostAsync(string namespaceKey, string segmentKey, CreateConstraintRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsPutAsync(string namespaceKey, string segmentKey, string id, UpdateConstraintRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsDeleteAsync(string namespaceKey, string segmentKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task AuthV1MethodKubernetesServiceaccountAsync(VerifyServiceAccountRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task AuthV1MethodOidcAuthorizeAsync(string provider, string state = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task AuthV1MethodOidcCallbackAsync(string provider, string code = null, string state = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task AuthV1MethodTokenAsync(CreateTokenRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task AuthV1SelfAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task AuthV1SelfExpireAsync(System.DateTimeOffset? expiresAt = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task AuthV1TokensGetAsync(Method? method = null, int? limit = null, string pageToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task AuthV1TokensGetAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task AuthV1TokensDeleteAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task EvaluateV1BatchAsync(BatchEvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task EvaluateV1BooleanAsync(EvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task EvaluateV1VariantAsync(EvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// OFREP provider configuration - /// - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task OfrepV1ConfigurationAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// OFREP bulk flag evaluation - /// - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task OfrepV1EvaluateFlagsPostAsync(EvaluateBulkRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// OFREP single flag evaluation - /// - /// OK - /// A server side error occurred. - System.Threading.Tasks.Task OfrepV1EvaluateFlagsPostAsync(string key, EvaluateFlagRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - } - - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class FliptRestClient : IFliptRestClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public FliptRestClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesGetAsync(int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces" - urlBuilder_.Append("api/v1/namespaces"); - urlBuilder_.Append('?'); - if (limit != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (offset != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (pageToken != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("pageToken")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(pageToken, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (reference != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesPostAsync(CreateNamespaceRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces" - urlBuilder_.Append("api/v1/namespaces"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesGetAsync(string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (key == null) - throw new System.ArgumentNullException("key"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{key}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append('?'); - if (reference != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesPutAsync(string key, UpdateNamespaceRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (key == null) - throw new System.ArgumentNullException("key"); - - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("PUT"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{key}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesDeleteAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (key == null) - throw new System.ArgumentNullException("key"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("DELETE"); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{key}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - return; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsGetAsync(string namespaceKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags"); - urlBuilder_.Append('?'); - if (limit != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (offset != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (pageToken != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("pageToken")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(pageToken, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (reference != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsPostAsync(string namespaceKey, CreateFlagRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsGetAsync(string namespaceKey, string flagKey, int? limit = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rollouts"); - urlBuilder_.Append('?'); - if (limit != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (pageToken != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("pageToken")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(pageToken, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (reference != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsPostAsync(string namespaceKey, string flagKey, CreateRolloutRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); - - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rollouts"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsOrderAsync(string namespaceKey, string flagKey, OrderRolloutsRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); - - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("PUT"); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts/order" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rollouts/order"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - return; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsGetAsync(string namespaceKey, string flagKey, string id, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); - - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts/{id}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rollouts/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append('?'); - if (reference != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsPutAsync(string namespaceKey, string flagKey, string id, UpdateRolloutRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); - - if (id == null) - throw new System.ArgumentNullException("id"); - - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("PUT"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts/{id}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rollouts/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRolloutsDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); - - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("DELETE"); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rollouts/{id}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rollouts/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - return; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesGetAsync(string namespaceKey, string flagKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rules"); - urlBuilder_.Append('?'); - if (limit != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (offset != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (pageToken != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("pageToken")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(pageToken, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (reference != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesPostAsync(string namespaceKey, string flagKey, CreateRuleRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); - - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rules"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesOrderAsync(string namespaceKey, string flagKey, OrderRulesRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); - - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("PUT"); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/order" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rules/order"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - return; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesGetAsync(string namespaceKey, string flagKey, string id, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); - - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{id}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rules/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append('?'); - if (reference != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesPutAsync(string namespaceKey, string flagKey, string id, UpdateRuleRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); - - if (id == null) - throw new System.ArgumentNullException("id"); - - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("PUT"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{id}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rules/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); - - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("DELETE"); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{id}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rules/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - return; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsPostAsync(string namespaceKey, string flagKey, string ruleId, CreateDistributionRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); - - if (ruleId == null) - throw new System.ArgumentNullException("ruleId"); - - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{ruleId}/distributions" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rules/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(ruleId, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/distributions"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsPutAsync(string namespaceKey, string flagKey, string ruleId, string id, UpdateDistributionRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); - - if (ruleId == null) - throw new System.ArgumentNullException("ruleId"); - - if (id == null) - throw new System.ArgumentNullException("id"); - - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("PUT"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{ruleId}/distributions/{id}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rules/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(ruleId, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/distributions/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsRulesDistributionsDeleteAsync(string namespaceKey, string flagKey, string ruleId, string id, string variantId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); - - if (ruleId == null) - throw new System.ArgumentNullException("ruleId"); - - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("DELETE"); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{ruleId}/distributions/{id}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/rules/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(ruleId, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/distributions/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append('?'); - if (variantId != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("variantId")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(variantId, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - return; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsPostAsync(string namespaceKey, string flagKey, CreateVariantRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); - - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/variants" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/variants"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsPutAsync(string namespaceKey, string flagKey, string id, UpdateVariantRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); - - if (id == null) - throw new System.ArgumentNullException("id"); - - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("PUT"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/variants/{id}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/variants/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsVariantsDeleteAsync(string namespaceKey, string flagKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (flagKey == null) - throw new System.ArgumentNullException("flagKey"); - - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("DELETE"); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{flagKey}/variants/{id}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(flagKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/variants/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - return; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsGetAsync(string namespaceKey, string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (key == null) - throw new System.ArgumentNullException("key"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{key}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append('?'); - if (reference != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsPutAsync(string namespaceKey, string key, UpdateFlagRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (key == null) - throw new System.ArgumentNullException("key"); - - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("PUT"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{key}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesFlagsDeleteAsync(string namespaceKey, string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (key == null) - throw new System.ArgumentNullException("key"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("DELETE"); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/flags/{key}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - return; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsGetAsync(string namespaceKey, int? limit = null, int? offset = null, string pageToken = null, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/segments" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/segments"); - urlBuilder_.Append('?'); - if (limit != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (offset != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (pageToken != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("pageToken")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(pageToken, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (reference != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsPostAsync(string namespaceKey, CreateSegmentRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/segments" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/segments"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsGetAsync(string namespaceKey, string key, string reference = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (key == null) - throw new System.ArgumentNullException("key"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/segments/{key}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/segments/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append('?'); - if (reference != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("reference")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(reference, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsPutAsync(string namespaceKey, string key, UpdateSegmentRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (key == null) - throw new System.ArgumentNullException("key"); - - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("PUT"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/segments/{key}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/segments/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsDeleteAsync(string namespaceKey, string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (key == null) - throw new System.ArgumentNullException("key"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("DELETE"); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/segments/{key}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/segments/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - return; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsPostAsync(string namespaceKey, string segmentKey, CreateConstraintRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (segmentKey == null) - throw new System.ArgumentNullException("segmentKey"); - - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/segments/{segmentKey}/constraints" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/segments/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(segmentKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/constraints"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsPutAsync(string namespaceKey, string segmentKey, string id, UpdateConstraintRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (segmentKey == null) - throw new System.ArgumentNullException("segmentKey"); - - if (id == null) - throw new System.ArgumentNullException("id"); - - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("PUT"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/segments/{segmentKey}/constraints/{id}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/segments/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(segmentKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/constraints/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ApiV1NamespacesSegmentsConstraintsDeleteAsync(string namespaceKey, string segmentKey, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (namespaceKey == null) - throw new System.ArgumentNullException("namespaceKey"); - - if (segmentKey == null) - throw new System.ArgumentNullException("segmentKey"); - - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("DELETE"); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "api/v1/namespaces/{namespaceKey}/segments/{segmentKey}/constraints/{id}" - urlBuilder_.Append("api/v1/namespaces/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(namespaceKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/segments/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(segmentKey, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/constraints/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - return; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task AuthV1MethodKubernetesServiceaccountAsync(VerifyServiceAccountRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "auth/v1/method/kubernetes/serviceaccount" - urlBuilder_.Append("auth/v1/method/kubernetes/serviceaccount"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task AuthV1MethodOidcAuthorizeAsync(string provider, string state = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (provider == null) - throw new System.ArgumentNullException("provider"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "auth/v1/method/oidc/{provider}/authorize" - urlBuilder_.Append("auth/v1/method/oidc/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(provider, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/authorize"); - urlBuilder_.Append('?'); - if (state != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("state")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(state, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task AuthV1MethodOidcCallbackAsync(string provider, string code = null, string state = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (provider == null) - throw new System.ArgumentNullException("provider"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "auth/v1/method/oidc/{provider}/callback" - urlBuilder_.Append("auth/v1/method/oidc/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(provider, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/callback"); - urlBuilder_.Append('?'); - if (code != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("code")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(code, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (state != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("state")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(state, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task AuthV1MethodTokenAsync(CreateTokenRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "auth/v1/method/token" - urlBuilder_.Append("auth/v1/method/token"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task AuthV1SelfAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "auth/v1/self" - urlBuilder_.Append("auth/v1/self"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task AuthV1SelfExpireAsync(System.DateTimeOffset? expiresAt = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); - request_.Method = new System.Net.Http.HttpMethod("PUT"); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "auth/v1/self/expire" - urlBuilder_.Append("auth/v1/self/expire"); - urlBuilder_.Append('?'); - if (expiresAt != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("expiresAt")).Append('=').Append(System.Uri.EscapeDataString(expiresAt.Value.ToString("s", System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - return; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task AuthV1TokensGetAsync(Method? method = null, int? limit = null, string pageToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "auth/v1/tokens" - urlBuilder_.Append("auth/v1/tokens"); - urlBuilder_.Append('?'); - if (method != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("method")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(method, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (limit != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (pageToken != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("pageToken")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(pageToken, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task AuthV1TokensGetAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "auth/v1/tokens/{id}" - urlBuilder_.Append("auth/v1/tokens/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task AuthV1TokensDeleteAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("DELETE"); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "auth/v1/tokens/{id}" - urlBuilder_.Append("auth/v1/tokens/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - return; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task EvaluateV1BatchAsync(BatchEvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "evaluate/v1/batch" - urlBuilder_.Append("evaluate/v1/batch"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task EvaluateV1BooleanAsync(EvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "evaluate/v1/boolean" - urlBuilder_.Append("evaluate/v1/boolean"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task EvaluateV1VariantAsync(EvaluationRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "evaluate/v1/variant" - urlBuilder_.Append("evaluate/v1/variant"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// OFREP provider configuration - /// - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task OfrepV1ConfigurationAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "ofrep/v1/configuration" - urlBuilder_.Append("ofrep/v1/configuration"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// OFREP bulk flag evaluation - /// - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task OfrepV1EvaluateFlagsPostAsync(EvaluateBulkRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "ofrep/v1/evaluate/flags" - urlBuilder_.Append("ofrep/v1/evaluate/flags"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// OFREP single flag evaluation - /// - /// OK - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task OfrepV1EvaluateFlagsPostAsync(string key, EvaluateFlagRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (key == null) - throw new System.ArgumentNullException("key"); - - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "ofrep/v1/evaluate/flags/{key}" - urlBuilder_.Append("ofrep/v1/evaluate/flags/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new FliptRestException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new FliptRestException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new FliptRestException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new FliptRestException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record Authentication - { - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public string Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("method")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public AuthenticationMethod Method { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("expiresAt")] - public System.DateTimeOffset ExpiresAt { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("createdAt")] - public System.DateTimeOffset CreatedAt { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] - public System.DateTimeOffset UpdatedAt { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("metadata")] - public System.Collections.Generic.IDictionary Metadata { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record AuthorizeURLResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("authorizeUrl")] - public string AuthorizeUrl { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record BatchEvaluationRequest - { - - [System.Text.Json.Serialization.JsonPropertyName("requestId")] - public string RequestId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("requests")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Requests { get; set; } = new System.Collections.ObjectModel.Collection(); - - [System.Text.Json.Serialization.JsonPropertyName("reference")] - public string Reference { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record BatchEvaluationResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("requestId")] - public string RequestId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("responses")] - public System.Collections.Generic.ICollection Responses { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("requestDurationMillis")] - public double RequestDurationMillis { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record BooleanEvaluationResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("enabled")] - public bool Enabled { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("reason")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public BooleanEvaluationResponseReason Reason { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("requestId")] - public string RequestId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("requestDurationMillis")] - public double RequestDurationMillis { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("timestamp")] - public System.DateTimeOffset Timestamp { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("flagKey")] - public string FlagKey { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record BulkEvaluationResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("flags")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Flags { get; set; } = new System.Collections.ObjectModel.Collection(); - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record CacheInvalidation - { - - [System.Text.Json.Serialization.JsonPropertyName("polling")] - public Polling Polling { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record CallbackResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("clientToken")] - public string ClientToken { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("authentication")] - public Authentication Authentication { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record Capabilities - { - - [System.Text.Json.Serialization.JsonPropertyName("cacheInvalidation")] - public CacheInvalidation CacheInvalidation { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("flagEvaluation")] - public FlagEvaluation FlagEvaluation { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record Constraint - { - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public string Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("segmentKey")] - public string SegmentKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("type")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public ConstraintType Type { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("property")] - public string Property { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("operator")] - public string Operator { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("value")] - public string Value { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("createdAt")] - public System.DateTimeOffset CreatedAt { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] - public System.DateTimeOffset UpdatedAt { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - public string NamespaceKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record CreateConstraintRequest - { - - [System.Text.Json.Serialization.JsonPropertyName("segmentKey")] - public string SegmentKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("type")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public CreateConstraintRequestType Type { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("property")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Property { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("operator")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Operator { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("value")] - public string Value { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - public string NamespaceKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record CreateDistributionRequest - { - - [System.Text.Json.Serialization.JsonPropertyName("flagKey")] - public string FlagKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("ruleId")] - public string RuleId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("variantId")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string VariantId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("rollout")] - public float Rollout { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - public string NamespaceKey { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record CreateFlagRequest - { - - [System.Text.Json.Serialization.JsonPropertyName("key")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Key { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("enabled")] - public bool Enabled { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - public string NamespaceKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("type")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public CreateFlagRequestType Type { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("metadata")] - public object Metadata { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record CreateNamespaceRequest - { - - [System.Text.Json.Serialization.JsonPropertyName("key")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Key { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record CreateRolloutRequest - { - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - public string NamespaceKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("flagKey")] - public string FlagKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("rank")] - public int Rank { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("segment")] - public RolloutSegment Segment { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("threshold")] - public RolloutThreshold Threshold { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record CreateRuleRequest - { - - [System.Text.Json.Serialization.JsonPropertyName("flagKey")] - public string FlagKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("segmentKey")] - public string SegmentKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("rank")] - public int Rank { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - public string NamespaceKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("segmentKeys")] - public System.Collections.Generic.ICollection SegmentKeys { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("segmentOperator")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public CreateRuleRequestSegmentOperator SegmentOperator { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record CreateSegmentRequest - { - - [System.Text.Json.Serialization.JsonPropertyName("key")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Key { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("matchType")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public CreateSegmentRequestMatchType MatchType { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - public string NamespaceKey { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record CreateTokenRequest - { - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("expiresAt")] - public System.DateTimeOffset ExpiresAt { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - public string NamespaceKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("metadata")] - public System.Collections.Generic.IDictionary Metadata { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record CreateTokenResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("clientToken")] - public string ClientToken { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("authentication")] - public Authentication Authentication { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record CreateVariantRequest - { - - [System.Text.Json.Serialization.JsonPropertyName("flagKey")] - public string FlagKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("key")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Key { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("attachment")] - public string Attachment { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - public string NamespaceKey { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record Distribution - { - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public string Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("ruleId")] - public string RuleId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("variantId")] - public string VariantId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("rollout")] - public float Rollout { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("createdAt")] - public System.DateTimeOffset CreatedAt { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] - public System.DateTimeOffset UpdatedAt { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record ErrorEvaluationResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("flagKey")] - public string FlagKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - public string NamespaceKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("reason")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public ErrorEvaluationResponseReason Reason { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record EvaluateBulkRequest - { - - [System.Text.Json.Serialization.JsonPropertyName("context")] - public System.Collections.Generic.IDictionary Context { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record EvaluateFlagRequest - { - - [System.Text.Json.Serialization.JsonPropertyName("key")] - public string Key { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("context")] - public System.Collections.Generic.IDictionary Context { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record EvaluatedFlag - { - - [System.Text.Json.Serialization.JsonPropertyName("key")] - public string Key { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("reason")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public EvaluatedFlagReason Reason { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("variant")] - public string Variant { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("metadata")] - public object Metadata { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("value")] - public GoogleProtobufValue Value { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record EvaluationRequest - { - - [System.Text.Json.Serialization.JsonPropertyName("requestId")] - public string RequestId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string NamespaceKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("flagKey")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string FlagKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("entityId")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string EntityId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("context")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.IDictionary Context { get; set; } = new System.Collections.Generic.Dictionary(); - - [System.Text.Json.Serialization.JsonPropertyName("reference")] - public string Reference { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record EvaluationResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("type")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public EvaluationResponseType Type { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("booleanResponse")] - public BooleanEvaluationResponse BooleanResponse { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("variantResponse")] - public VariantEvaluationResponse VariantResponse { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("errorResponse")] - public ErrorEvaluationResponse ErrorResponse { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record Flag - { - - [System.Text.Json.Serialization.JsonPropertyName("key")] - public string Key { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("enabled")] - public bool Enabled { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("createdAt")] - public System.DateTimeOffset CreatedAt { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] - public System.DateTimeOffset UpdatedAt { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("variants")] - public System.Collections.Generic.ICollection Variants { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - public string NamespaceKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("type")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public FlagType Type { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("defaultVariant")] - public Variant DefaultVariant { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("metadata")] - public object Metadata { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record FlagEvaluation - { - - [System.Text.Json.Serialization.JsonPropertyName("supportedTypes")] - public System.Collections.Generic.ICollection SupportedTypes { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record FlagList - { - - [System.Text.Json.Serialization.JsonPropertyName("flags")] - public System.Collections.Generic.ICollection Flags { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("nextPageToken")] - public string NextPageToken { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("totalCount")] - public int TotalCount { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record GetProviderConfigurationResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("capabilities")] - public Capabilities Capabilities { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - /// - /// Represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values. - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record GoogleProtobufValue - { - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record ListAuthenticationsResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("authentications")] - public System.Collections.Generic.ICollection Authentications { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("nextPageToken")] - public string NextPageToken { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record Namespace - { - - [System.Text.Json.Serialization.JsonPropertyName("key")] - public string Key { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("protected")] - public bool Protected { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("createdAt")] - public System.DateTimeOffset CreatedAt { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] - public System.DateTimeOffset UpdatedAt { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record NamespaceList - { - - [System.Text.Json.Serialization.JsonPropertyName("namespaces")] - public System.Collections.Generic.ICollection Namespaces { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("nextPageToken")] - public string NextPageToken { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("totalCount")] - public int TotalCount { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record OrderRolloutsRequest - { - - [System.Text.Json.Serialization.JsonPropertyName("flagKey")] - public string FlagKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - public string NamespaceKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("rolloutIds")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection RolloutIds { get; set; } = new System.Collections.ObjectModel.Collection(); - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record OrderRulesRequest - { - - [System.Text.Json.Serialization.JsonPropertyName("flagKey")] - public string FlagKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("ruleIds")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection RuleIds { get; set; } = new System.Collections.ObjectModel.Collection(); - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - public string NamespaceKey { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record Polling - { - - [System.Text.Json.Serialization.JsonPropertyName("enabled")] - public bool Enabled { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("minPollingIntervalMs")] - public int MinPollingIntervalMs { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record Rollout - { - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public string Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - public string NamespaceKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("flagKey")] - public string FlagKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("type")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public RolloutType Type { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("rank")] - public int Rank { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("createdAt")] - public System.DateTimeOffset CreatedAt { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] - public System.DateTimeOffset UpdatedAt { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("segment")] - public RolloutSegment Segment { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("threshold")] - public RolloutThreshold Threshold { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record RolloutList - { - - [System.Text.Json.Serialization.JsonPropertyName("rules")] - public System.Collections.Generic.ICollection Rules { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("nextPageToken")] - public string NextPageToken { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("totalCount")] - public int TotalCount { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record RolloutSegment - { - - [System.Text.Json.Serialization.JsonPropertyName("segmentKey")] - public string SegmentKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("value")] - public bool Value { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("segmentKeys")] - public System.Collections.Generic.ICollection SegmentKeys { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("segmentOperator")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public RolloutSegmentSegmentOperator SegmentOperator { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record RolloutThreshold - { - - [System.Text.Json.Serialization.JsonPropertyName("percentage")] - public float Percentage { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("value")] - public bool Value { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record Rule - { - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public string Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("flagKey")] - public string FlagKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("segmentKey")] - public string SegmentKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("distributions")] - public System.Collections.Generic.ICollection Distributions { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("rank")] - public int Rank { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("createdAt")] - public System.DateTimeOffset CreatedAt { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] - public System.DateTimeOffset UpdatedAt { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - public string NamespaceKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("segmentKeys")] - public System.Collections.Generic.ICollection SegmentKeys { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("segmentOperator")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public RuleSegmentOperator SegmentOperator { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record RuleList - { - - [System.Text.Json.Serialization.JsonPropertyName("rules")] - public System.Collections.Generic.ICollection Rules { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("nextPageToken")] - public string NextPageToken { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("totalCount")] - public int TotalCount { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record Segment - { - - [System.Text.Json.Serialization.JsonPropertyName("key")] - public string Key { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("createdAt")] - public System.DateTimeOffset CreatedAt { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] - public System.DateTimeOffset UpdatedAt { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("constraints")] - public System.Collections.Generic.ICollection Constraints { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("matchType")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public SegmentMatchType MatchType { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - public string NamespaceKey { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record SegmentList - { - - [System.Text.Json.Serialization.JsonPropertyName("segments")] - public System.Collections.Generic.ICollection Segments { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("nextPageToken")] - public string NextPageToken { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("totalCount")] - public int TotalCount { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record UpdateConstraintRequest - { - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public string Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("segmentKey")] - public string SegmentKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("type")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public UpdateConstraintRequestType Type { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("property")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Property { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("operator")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Operator { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("value")] - public string Value { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - public string NamespaceKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record UpdateDistributionRequest - { - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public string Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("flagKey")] - public string FlagKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("ruleId")] - public string RuleId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("variantId")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string VariantId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("rollout")] - public float Rollout { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - public string NamespaceKey { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record UpdateFlagRequest - { - - [System.Text.Json.Serialization.JsonPropertyName("key")] - public string Key { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("enabled")] - public bool Enabled { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - public string NamespaceKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("defaultVariantId")] - public string DefaultVariantId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("metadata")] - public object Metadata { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record UpdateNamespaceRequest - { - - [System.Text.Json.Serialization.JsonPropertyName("key")] - public string Key { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record UpdateRolloutRequest - { - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public string Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - public string NamespaceKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("flagKey")] - public string FlagKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("segment")] - public RolloutSegment Segment { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("threshold")] - public RolloutThreshold Threshold { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record UpdateRuleRequest - { - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public string Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("flagKey")] - public string FlagKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("segmentKey")] - public string SegmentKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - public string NamespaceKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("segmentKeys")] - public System.Collections.Generic.ICollection SegmentKeys { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("segmentOperator")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public UpdateRuleRequestSegmentOperator SegmentOperator { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record UpdateSegmentRequest - { - - [System.Text.Json.Serialization.JsonPropertyName("key")] - public string Key { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("matchType")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public UpdateSegmentRequestMatchType MatchType { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - public string NamespaceKey { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record UpdateVariantRequest - { - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public string Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("flagKey")] - public string FlagKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("key")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Key { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("attachment")] - public string Attachment { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - public string NamespaceKey { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record Variant - { - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public string Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("flagKey")] - public string FlagKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("key")] - public string Key { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("createdAt")] - public System.DateTimeOffset CreatedAt { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] - public System.DateTimeOffset UpdatedAt { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("attachment")] - public string Attachment { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("namespaceKey")] - public string NamespaceKey { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record VariantEvaluationResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("match")] - public bool Match { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("segmentKeys")] - public System.Collections.Generic.ICollection SegmentKeys { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("reason")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public VariantEvaluationResponseReason Reason { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("variantKey")] - public string VariantKey { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("variantAttachment")] - public string VariantAttachment { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("requestId")] - public string RequestId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("requestDurationMillis")] - public double RequestDurationMillis { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("timestamp")] - public System.DateTimeOffset Timestamp { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("flagKey")] - public string FlagKey { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record VerifyServiceAccountRequest - { - - [System.Text.Json.Serialization.JsonPropertyName("serviceAccountToken")] - public string ServiceAccountToken { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial record VerifyServiceAccountResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("clientToken")] - public string ClientToken { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("authentication")] - public Authentication Authentication { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum Method - { - - [System.Runtime.Serialization.EnumMember(Value = @"METHOD_NONE")] - METHOD_NONE = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"METHOD_TOKEN")] - METHOD_TOKEN = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"METHOD_OIDC")] - METHOD_OIDC = 2, - - [System.Runtime.Serialization.EnumMember(Value = @"METHOD_KUBERNETES")] - METHOD_KUBERNETES = 3, - - [System.Runtime.Serialization.EnumMember(Value = @"METHOD_GITHUB")] - METHOD_GITHUB = 4, - - [System.Runtime.Serialization.EnumMember(Value = @"METHOD_JWT")] - METHOD_JWT = 5, - - [System.Runtime.Serialization.EnumMember(Value = @"METHOD_CLOUD")] - METHOD_CLOUD = 6, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum AuthenticationMethod - { - - [System.Runtime.Serialization.EnumMember(Value = @"METHOD_NONE")] - METHOD_NONE = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"METHOD_TOKEN")] - METHOD_TOKEN = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"METHOD_OIDC")] - METHOD_OIDC = 2, - - [System.Runtime.Serialization.EnumMember(Value = @"METHOD_KUBERNETES")] - METHOD_KUBERNETES = 3, - - [System.Runtime.Serialization.EnumMember(Value = @"METHOD_GITHUB")] - METHOD_GITHUB = 4, - - [System.Runtime.Serialization.EnumMember(Value = @"METHOD_JWT")] - METHOD_JWT = 5, - - [System.Runtime.Serialization.EnumMember(Value = @"METHOD_CLOUD")] - METHOD_CLOUD = 6, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum BooleanEvaluationResponseReason - { - - [System.Runtime.Serialization.EnumMember(Value = @"UNKNOWN_EVALUATION_REASON")] - UNKNOWN_EVALUATION_REASON = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"FLAG_DISABLED_EVALUATION_REASON")] - FLAG_DISABLED_EVALUATION_REASON = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"MATCH_EVALUATION_REASON")] - MATCH_EVALUATION_REASON = 2, - - [System.Runtime.Serialization.EnumMember(Value = @"DEFAULT_EVALUATION_REASON")] - DEFAULT_EVALUATION_REASON = 3, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum ConstraintType - { - - [System.Runtime.Serialization.EnumMember(Value = @"UNKNOWN_COMPARISON_TYPE")] - UNKNOWN_COMPARISON_TYPE = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"STRING_COMPARISON_TYPE")] - STRING_COMPARISON_TYPE = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"NUMBER_COMPARISON_TYPE")] - NUMBER_COMPARISON_TYPE = 2, - - [System.Runtime.Serialization.EnumMember(Value = @"BOOLEAN_COMPARISON_TYPE")] - BOOLEAN_COMPARISON_TYPE = 3, - - [System.Runtime.Serialization.EnumMember(Value = @"DATETIME_COMPARISON_TYPE")] - DATETIME_COMPARISON_TYPE = 4, - - [System.Runtime.Serialization.EnumMember(Value = @"ENTITY_ID_COMPARISON_TYPE")] - ENTITY_ID_COMPARISON_TYPE = 5, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum CreateConstraintRequestType - { - - [System.Runtime.Serialization.EnumMember(Value = @"UNKNOWN_COMPARISON_TYPE")] - UNKNOWN_COMPARISON_TYPE = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"STRING_COMPARISON_TYPE")] - STRING_COMPARISON_TYPE = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"NUMBER_COMPARISON_TYPE")] - NUMBER_COMPARISON_TYPE = 2, - - [System.Runtime.Serialization.EnumMember(Value = @"BOOLEAN_COMPARISON_TYPE")] - BOOLEAN_COMPARISON_TYPE = 3, - - [System.Runtime.Serialization.EnumMember(Value = @"DATETIME_COMPARISON_TYPE")] - DATETIME_COMPARISON_TYPE = 4, - - [System.Runtime.Serialization.EnumMember(Value = @"ENTITY_ID_COMPARISON_TYPE")] - ENTITY_ID_COMPARISON_TYPE = 5, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum CreateFlagRequestType - { - - [System.Runtime.Serialization.EnumMember(Value = @"VARIANT_FLAG_TYPE")] - VARIANT_FLAG_TYPE = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"BOOLEAN_FLAG_TYPE")] - BOOLEAN_FLAG_TYPE = 1, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum CreateRuleRequestSegmentOperator - { - - [System.Runtime.Serialization.EnumMember(Value = @"OR_SEGMENT_OPERATOR")] - OR_SEGMENT_OPERATOR = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"AND_SEGMENT_OPERATOR")] - AND_SEGMENT_OPERATOR = 1, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum CreateSegmentRequestMatchType - { - - [System.Runtime.Serialization.EnumMember(Value = @"ALL_MATCH_TYPE")] - ALL_MATCH_TYPE = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"ANY_MATCH_TYPE")] - ANY_MATCH_TYPE = 1, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum ErrorEvaluationResponseReason - { - - [System.Runtime.Serialization.EnumMember(Value = @"UNKNOWN_ERROR_EVALUATION_REASON")] - UNKNOWN_ERROR_EVALUATION_REASON = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"NOT_FOUND_ERROR_EVALUATION_REASON")] - NOT_FOUND_ERROR_EVALUATION_REASON = 1, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum EvaluatedFlagReason - { - - [System.Runtime.Serialization.EnumMember(Value = @"UNKNOWN")] - UNKNOWN = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"DISABLED")] - DISABLED = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"TARGETING_MATCH")] - TARGETING_MATCH = 2, - - [System.Runtime.Serialization.EnumMember(Value = @"DEFAULT")] - DEFAULT = 3, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum EvaluationResponseType - { - - [System.Runtime.Serialization.EnumMember(Value = @"VARIANT_EVALUATION_RESPONSE_TYPE")] - VARIANT_EVALUATION_RESPONSE_TYPE = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"BOOLEAN_EVALUATION_RESPONSE_TYPE")] - BOOLEAN_EVALUATION_RESPONSE_TYPE = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"ERROR_EVALUATION_RESPONSE_TYPE")] - ERROR_EVALUATION_RESPONSE_TYPE = 2, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum FlagType - { - - [System.Runtime.Serialization.EnumMember(Value = @"VARIANT_FLAG_TYPE")] - VARIANT_FLAG_TYPE = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"BOOLEAN_FLAG_TYPE")] - BOOLEAN_FLAG_TYPE = 1, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum RolloutType - { - - [System.Runtime.Serialization.EnumMember(Value = @"UNKNOWN_ROLLOUT_TYPE")] - UNKNOWN_ROLLOUT_TYPE = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"SEGMENT_ROLLOUT_TYPE")] - SEGMENT_ROLLOUT_TYPE = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"THRESHOLD_ROLLOUT_TYPE")] - THRESHOLD_ROLLOUT_TYPE = 2, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum RolloutSegmentSegmentOperator - { - - [System.Runtime.Serialization.EnumMember(Value = @"OR_SEGMENT_OPERATOR")] - OR_SEGMENT_OPERATOR = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"AND_SEGMENT_OPERATOR")] - AND_SEGMENT_OPERATOR = 1, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum RuleSegmentOperator - { - - [System.Runtime.Serialization.EnumMember(Value = @"OR_SEGMENT_OPERATOR")] - OR_SEGMENT_OPERATOR = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"AND_SEGMENT_OPERATOR")] - AND_SEGMENT_OPERATOR = 1, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum SegmentMatchType - { - - [System.Runtime.Serialization.EnumMember(Value = @"ALL_MATCH_TYPE")] - ALL_MATCH_TYPE = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"ANY_MATCH_TYPE")] - ANY_MATCH_TYPE = 1, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum UpdateConstraintRequestType - { - - [System.Runtime.Serialization.EnumMember(Value = @"UNKNOWN_COMPARISON_TYPE")] - UNKNOWN_COMPARISON_TYPE = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"STRING_COMPARISON_TYPE")] - STRING_COMPARISON_TYPE = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"NUMBER_COMPARISON_TYPE")] - NUMBER_COMPARISON_TYPE = 2, - - [System.Runtime.Serialization.EnumMember(Value = @"BOOLEAN_COMPARISON_TYPE")] - BOOLEAN_COMPARISON_TYPE = 3, - - [System.Runtime.Serialization.EnumMember(Value = @"DATETIME_COMPARISON_TYPE")] - DATETIME_COMPARISON_TYPE = 4, - - [System.Runtime.Serialization.EnumMember(Value = @"ENTITY_ID_COMPARISON_TYPE")] - ENTITY_ID_COMPARISON_TYPE = 5, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum UpdateRuleRequestSegmentOperator - { - - [System.Runtime.Serialization.EnumMember(Value = @"OR_SEGMENT_OPERATOR")] - OR_SEGMENT_OPERATOR = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"AND_SEGMENT_OPERATOR")] - AND_SEGMENT_OPERATOR = 1, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum UpdateSegmentRequestMatchType - { - - [System.Runtime.Serialization.EnumMember(Value = @"ALL_MATCH_TYPE")] - ALL_MATCH_TYPE = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"ANY_MATCH_TYPE")] - ANY_MATCH_TYPE = 1, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum VariantEvaluationResponseReason - { - - [System.Runtime.Serialization.EnumMember(Value = @"UNKNOWN_EVALUATION_REASON")] - UNKNOWN_EVALUATION_REASON = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"FLAG_DISABLED_EVALUATION_REASON")] - FLAG_DISABLED_EVALUATION_REASON = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"MATCH_EVALUATION_REASON")] - MATCH_EVALUATION_REASON = 2, - - [System.Runtime.Serialization.EnumMember(Value = @"DEFAULT_EVALUATION_REASON")] - DEFAULT_EVALUATION_REASON = 3, - - } - - - - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class FliptRestException : System.Exception - { - public int StatusCode { get; private set; } - - public string Response { get; private set; } - - public System.Collections.Generic.IReadOnlyDictionary> Headers { get; private set; } - - public FliptRestException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Exception innerException) - : base(message + "\n\nStatus: " + statusCode + "\nResponse: \n" + ((response == null) ? "(null)" : response.Substring(0, response.Length >= 512 ? 512 : response.Length)), innerException) - { - StatusCode = statusCode; - Response = response; - Headers = headers; - } - - public override string ToString() - { - return string.Format("HTTP Response: \n\n{0}\n\n{1}", Response, base.ToString()); - } - } - - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class FliptRestException : FliptRestException - { - public TResult Result { get; private set; } - - public FliptRestException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, TResult result, System.Exception innerException) - : base(message, statusCode, response, headers, innerException) - { - Result = result; - } - } - -} - -#pragma warning restore 108 -#pragma warning restore 114 -#pragma warning restore 472 -#pragma warning restore 612 -#pragma warning restore 1573 -#pragma warning restore 1591 -#pragma warning restore 8073 -#pragma warning restore 3016 -#pragma warning restore 8603 -#pragma warning restore 8604 -#pragma warning restore 8625 \ No newline at end of file diff --git a/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj b/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj index a4c22b23..2fd0966b 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj +++ b/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj @@ -10,6 +10,13 @@ Jean Andrei de la Cruz Austria + + + + <_Parameter1>$(MSBuildProjectName).Test + + + @@ -17,9 +24,14 @@ + latest + + + + From 128c142190655f384590f33c97821b41c2d8d1cc Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Tue, 8 Oct 2024 17:06:34 +0200 Subject: [PATCH 33/47] FliptProvider: Made constructor that receives a dependent interface internal Signed-off-by: Andrei de la Cruz --- .../FliptProvider.cs | 113 +++++++++--------- .../FliptToOpenFeatureConverter.cs | 20 +++- 2 files changed, 73 insertions(+), 60 deletions(-) diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptProvider.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptProvider.cs index 7dcd747d..6d0754ef 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/FliptProvider.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptProvider.cs @@ -10,67 +10,72 @@ namespace OpenFeature.Contrib.Providers.Flipt; /// /// Accepts an instantiated IFliptClientWrapper instance /// -/// -public class FliptProvider(IFliptToOpenFeatureConverter fliptToOpenFeatureConverter) : FeatureProvider +public class FliptProvider : FeatureProvider { private static readonly Metadata Metadata = new("Flipt Provider"); + private readonly IFliptToOpenFeatureConverter _fliptToOpenFeatureConverter; -/// -/// Instantiate a FliptProvider using configuration params -/// -/// Url of flipt instance -/// Namespace used for querying flags -/// Authentication access token -/// Timeout when calling flipt endpoints in seconds -public FliptProvider(string fliptUrl, string namespaceKey = "default", string clientToken = "", - int timeoutInSeconds = 30) : this(new FliptToOpenFeatureConverter(fliptUrl, namespaceKey, clientToken, - timeoutInSeconds)) -{ -} + /// + /// Instantiate a FliptProvider using configuration params + /// + /// Url of flipt instance + /// Namespace used for querying flags + /// Authentication access token + /// Timeout when calling flipt endpoints in seconds + public FliptProvider(string fliptUrl, string namespaceKey = "default", string clientToken = "", + int timeoutInSeconds = 30) : this(new FliptToOpenFeatureConverter(fliptUrl, namespaceKey, clientToken, + timeoutInSeconds)) + { + } -/// -public override Metadata GetMetadata() -{ - return Metadata; -} + internal FliptProvider(IFliptToOpenFeatureConverter fliptToOpenFeatureConverter) + { + _fliptToOpenFeatureConverter = fliptToOpenFeatureConverter; + } -/// -public override async Task> ResolveBooleanValueAsync(string flagKey, bool defaultValue, - EvaluationContext context = null, - CancellationToken cancellationToken = new()) -{ - return await fliptToOpenFeatureConverter.EvaluateBooleanAsync(flagKey, defaultValue, context); -} + /// + public override Metadata GetMetadata() + { + return Metadata; + } -/// -public override async Task> ResolveStringValueAsync(string flagKey, - string defaultValue, EvaluationContext context = null, - CancellationToken cancellationToken = new()) -{ - return await fliptToOpenFeatureConverter.EvaluateAsync(flagKey, defaultValue, context); -} + /// + public override async Task> ResolveBooleanValueAsync(string flagKey, bool defaultValue, + EvaluationContext context = null, + CancellationToken cancellationToken = new()) + { + return await _fliptToOpenFeatureConverter.EvaluateBooleanAsync(flagKey, defaultValue, context); + } -/// -public override async Task> ResolveIntegerValueAsync(string flagKey, int defaultValue, - EvaluationContext context = null, - CancellationToken cancellationToken = new()) -{ - return await fliptToOpenFeatureConverter.EvaluateAsync(flagKey, defaultValue, context); -} + /// + public override async Task> ResolveStringValueAsync(string flagKey, + string defaultValue, EvaluationContext context = null, + CancellationToken cancellationToken = new()) + { + return await _fliptToOpenFeatureConverter.EvaluateAsync(flagKey, defaultValue, context); + } -/// -public override async Task> ResolveDoubleValueAsync(string flagKey, double defaultValue, - EvaluationContext context = null, - CancellationToken cancellationToken = new()) -{ - return await fliptToOpenFeatureConverter.EvaluateAsync(flagKey, defaultValue, context); -} + /// + public override async Task> ResolveIntegerValueAsync(string flagKey, int defaultValue, + EvaluationContext context = null, + CancellationToken cancellationToken = new()) + { + return await _fliptToOpenFeatureConverter.EvaluateAsync(flagKey, defaultValue, context); + } -/// -public override async Task> ResolveStructureValueAsync(string flagKey, Value defaultValue, - EvaluationContext context = null, - CancellationToken cancellationToken = new()) -{ - return await fliptToOpenFeatureConverter.EvaluateAsync(flagKey, defaultValue, context); -} + /// + public override async Task> ResolveDoubleValueAsync(string flagKey, double defaultValue, + EvaluationContext context = null, + CancellationToken cancellationToken = new()) + { + return await _fliptToOpenFeatureConverter.EvaluateAsync(flagKey, defaultValue, context); + } + + /// + public override async Task> ResolveStructureValueAsync(string flagKey, Value defaultValue, + EvaluationContext context = null, + CancellationToken cancellationToken = new()) + { + return await _fliptToOpenFeatureConverter.EvaluateAsync(flagKey, defaultValue, context); + } } \ No newline at end of file diff --git a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs index 8c558d26..cf54c183 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs +++ b/src/OpenFeature.Contrib.Providers.Flipt/FliptToOpenFeatureConverter.cs @@ -14,9 +14,11 @@ namespace OpenFeature.Contrib.Providers.Flipt; /// /// A wrapper of fliptClient to handle data casting and error mappings to OpenFeature models /// -public class FliptToOpenFeatureConverter(IFliptClientWrapper fliptClientWrapper, string namespaceKey = "default") - : IFliptToOpenFeatureConverter +public class FliptToOpenFeatureConverter : IFliptToOpenFeatureConverter { + private readonly IFliptClientWrapper _fliptClientWrapper; + private readonly string _namespaceKey; + /// /// Wrapper that uses Flipt to OpenFeature compliant models /// @@ -32,13 +34,19 @@ public FliptToOpenFeatureConverter(string fliptUrl, { } + internal FliptToOpenFeatureConverter(IFliptClientWrapper fliptClientWrapper, string namespaceKey = "default") + { + _fliptClientWrapper = fliptClientWrapper; + _namespaceKey = namespaceKey; + } + /// public async Task> EvaluateAsync(string flagKey, T defaultValue, EvaluationContext context = null) { var evaluationRequest = new EvaluationRequest { - NamespaceKey = namespaceKey, + NamespaceKey = _namespaceKey, FlagKey = flagKey, EntityId = context?.TargetingKey ?? "", Context = context.ToStringDictionary() @@ -46,7 +54,7 @@ public async Task> EvaluateAsync(string flagKey, T defau try { - var evaluationResponse = await fliptClientWrapper.EvaluateVariantAsync(evaluationRequest); + var evaluationResponse = await _fliptClientWrapper.EvaluateVariantAsync(evaluationRequest); if (evaluationResponse.Reason == VariantEvaluationResponseReason.FLAG_DISABLED_EVALUATION_REASON) return new ResolutionDetails(flagKey, defaultValue, ErrorType.None, @@ -94,12 +102,12 @@ public async Task> EvaluateBooleanAsync(string flagKey, { var evaluationRequest = new EvaluationRequest { - NamespaceKey = namespaceKey, + NamespaceKey = _namespaceKey, FlagKey = flagKey, EntityId = context?.TargetingKey ?? "", Context = context.ToStringDictionary() }; - var boolEvaluationResponse = await fliptClientWrapper.EvaluateBooleanAsync(evaluationRequest); + var boolEvaluationResponse = await _fliptClientWrapper.EvaluateBooleanAsync(evaluationRequest); return new ResolutionDetails(flagKey, boolEvaluationResponse.Enabled, ErrorType.None, Reason.TargetingMatch); } From 05944bf1cea3ef31a092b54f2ed151af735c4fcb Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Tue, 8 Oct 2024 17:11:01 +0200 Subject: [PATCH 34/47] FliptProvider: Updated component_owners Signed-off-by: Andrei de la Cruz --- .github/component_owners.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/component_owners.yml b/.github/component_owners.yml index cae64618..4fdbf288 100644 --- a/.github/component_owners.yml +++ b/.github/component_owners.yml @@ -22,6 +22,9 @@ components: src/OpenFeature.Contrib.Providers.Statsig: - jenshenneberg - lattenborough + src/OpenFeature.Contrib.Providers.Flipt: + - jeandreidc + - markphelps # test/ test/OpenFeature.Contrib.Hooks.Otel.Test: @@ -45,6 +48,9 @@ components: test/src/OpenFeature.Contrib.Providers.Statsig.Test: - jenshenneberg - lattenborough + test/src/OpenFeature.Contrib.Providers.Flipt.Test: + - jeandreidc + - markphelps ignored-authors: - renovate-bot From d491ef3fdf95fc237f77e03fedaa394e7a824896 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Tue, 8 Oct 2024 19:04:41 +0200 Subject: [PATCH 35/47] Update readme Signed-off-by: Andrei de la Cruz --- src/OpenFeature.Contrib.Providers.Flipt/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/OpenFeature.Contrib.Providers.Flipt/README.md b/src/OpenFeature.Contrib.Providers.Flipt/README.md index 3f74fbad..128425f4 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/README.md +++ b/src/OpenFeature.Contrib.Providers.Flipt/README.md @@ -92,7 +92,9 @@ used to generate a REST client using [nswag](https://github.com/RicoSuter/NSwag) ## Updating the REST Client -To generate or update the Flipt REST client, follow these steps: +To generate or update the Flipt REST client **manually**, follow these steps: + +_This is generated automatically during build time and is saved in the `/obj/` folder_ ### 1. Download the OpenAPI Specification From 21104607e09ac5981924f0306cf88a6bb637dc8a Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Thu, 10 Oct 2024 11:14:49 +0200 Subject: [PATCH 36/47] Reverted unintended lint changes to Flagsmith.csproj Signed-off-by: Andrei de la Cruz --- ...Feature.Contrib.Providers.Flagsmith.csproj | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/OpenFeature.Contrib.Providers.Flagsmith/OpenFeature.Contrib.Providers.Flagsmith.csproj b/src/OpenFeature.Contrib.Providers.Flagsmith/OpenFeature.Contrib.Providers.Flagsmith.csproj index eca241e7..7a1f1134 100644 --- a/src/OpenFeature.Contrib.Providers.Flagsmith/OpenFeature.Contrib.Providers.Flagsmith.csproj +++ b/src/OpenFeature.Contrib.Providers.Flagsmith/OpenFeature.Contrib.Providers.Flagsmith.csproj @@ -1,31 +1,31 @@  - - OpenFeature.Contrib.Providers.Flagsmith - 0.2.0 - $(VersionNumber) - $(VersionNumber) - $(VersionNumber) - Flagsmith provider for .NET - Vladimir Petrusevici - + + OpenFeature.Contrib.Providers.Flagsmith + 0.2.0 + $(VersionNumber) + $(VersionNumber) + $(VersionNumber) + Flagsmith provider for .NET + Vladimir Petrusevici + - - - - <_Parameter1>$(MSBuildProjectName).Test - - + + + + <_Parameter1>$(MSBuildProjectName).Test + + - - - + + + - - latest - + + latest + From 062445a628da427aab64f732115be20edfe6276e Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Thu, 10 Oct 2024 11:15:25 +0200 Subject: [PATCH 37/47] Fixed Nswag build time error, updated README, removed openapi.yaml curl command from build events Signed-off-by: Andrei de la Cruz --- .../OpenFeature.Contrib.Providers.Flipt.csproj | 4 ++-- src/OpenFeature.Contrib.Providers.Flipt/README.md | 5 +++-- .../OpenFeature.Contrib.Providers.Flipt.Test.csproj | 4 ---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj b/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj index 2fd0966b..c93fb223 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj +++ b/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj @@ -31,7 +31,7 @@ latest - - + + diff --git a/src/OpenFeature.Contrib.Providers.Flipt/README.md b/src/OpenFeature.Contrib.Providers.Flipt/README.md index 128425f4..fdb3d38d 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/README.md +++ b/src/OpenFeature.Contrib.Providers.Flipt/README.md @@ -94,12 +94,13 @@ used to generate a REST client using [nswag](https://github.com/RicoSuter/NSwag) To generate or update the Flipt REST client **manually**, follow these steps: -_This is generated automatically during build time and is saved in the `/obj/` folder_ +_The **Rest client is generated automatically during build time** using the committed `openapi.yaml` file and is saved +in the `/obj/` folder_ ### 1. Download the OpenAPI Specification First, download the latest `openapi.yaml` file from the Flipt GitHub repository. This can be done manually or by using a -command like `curl`: +command like `curl` in the `/src/OpenFeature.Contrib.Providers.Flipt/`: ``` curl https://raw.githubusercontent.com/flipt-io/flipt/refs/heads/main/openapi.yaml -o openapi.yaml diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj b/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj index 7acc2090..8e41387a 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj @@ -10,11 +10,7 @@ - - - - From 14a22236a1c6740df80872a5ab5a8ff316fb5aa9 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Thu, 10 Oct 2024 11:18:29 +0200 Subject: [PATCH 38/47] lint changes in test Signed-off-by: Andrei de la Cruz --- .../FliptProviderTest.cs | 4 ++-- .../FliptToOpenFeatureConverterTest.cs | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs index ee5d1d46..07bfd62c 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptProviderTest.cs @@ -23,7 +23,7 @@ public void CreateFliptProvider_ShouldReturnFliptProvider() [Fact] public void CreateFliptProvider_GivenEmptyUrl_ShouldThrowInvalidOperationException() { - var act = void () => new FliptProvider(""); + var act = void() => new FliptProvider(""); act.Should().Throw(); } @@ -49,7 +49,7 @@ public async Task var provider = new FliptProvider(new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object)); - var resolution = async Task> () => + var resolution = async Task>() => await provider.ResolveDoubleValueAsync(flagKey, 0.0); await resolution.Should().ThrowAsync(); } diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs index d4d23e5c..2e41215b 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs @@ -27,7 +27,7 @@ public async Task EvaluateBooleanAsync_GivenHttpRequestException_ShouldHandleHtt .ThrowsAsync(new FliptRestException("", (int)thrownStatusCode, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); - var resolution = async Task> () => + var resolution = async Task>() => await fliptToOpenFeature.EvaluateBooleanAsync("flagKey", fallbackValue); await resolution.Should().ThrowAsync(); @@ -67,7 +67,7 @@ public async Task EvaluateBooleanAsync_GivenNonExistentFlag_ShouldReturnDefaultV .ThrowsAsync(new FliptRestException("", (int)HttpStatusCode.NotFound, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); - var resolution = async Task> () => + var resolution = async Task>() => await fliptToOpenFeature.EvaluateBooleanAsync("flagKey", fallBackValue); await resolution.Should().ThrowAsync(); @@ -90,7 +90,7 @@ public async Task EvaluateAsync_GivenHttpRequestException_ShouldHandleHttpReques .ThrowsAsync(new FliptRestException("", (int)thrownStatusCode, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); - var resolution = async Task> () => + var resolution = async Task>() => await fliptToOpenFeature.EvaluateAsync("flagKey", fallbackValue); await resolution.Should().ThrowAsync(); @@ -132,10 +132,10 @@ public async Task EvaluateAsync_GivenExistingVariantFlagAndWithAnObject_ShouldRe const string variantKey = "variant-A"; const string valueFromSrc = """ { - "name": "Mr. Robinson", + "name": "Mr. Robinson", "age": 12, } - """; + """; var expectedValue = new Value(new Structure(new Dictionary { { "name", new Value("Mr. Robinson") }, { "age", new Value(12) } @@ -176,7 +176,7 @@ public async Task .ThrowsAsync(new FliptRestException("", (int)HttpStatusCode.NotFound, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); - var resolution = async Task> () => + var resolution = async Task>() => await fliptToOpenFeature.EvaluateAsync("non-existent-flag", fallbackValue); await resolution.Should().ThrowAsync(); @@ -193,7 +193,7 @@ public async Task .ThrowsAsync(new FliptRestException("", (int)HttpStatusCode.NotFound, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); - var resolution = async Task> () => + var resolution = async Task>() => await fliptToOpenFeature.EvaluateAsync("non-existent-flag", fallbackValue); await resolution.Should().ThrowAsync(); From 582a4fb3520b00ae374a711f1ea305bcc839b40a Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Thu, 10 Oct 2024 12:08:36 +0200 Subject: [PATCH 39/47] Updated System.Text.Json to latest version Signed-off-by: Andrei de la Cruz --- .../OpenFeature.Contrib.Providers.Flipt.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj b/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj index c93fb223..65cd4f4b 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj +++ b/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj @@ -18,13 +18,13 @@ - + From 09dbc34adf094e6283f13fd4ea5d6e88e9943ba6 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Tue, 15 Oct 2024 00:26:44 +0200 Subject: [PATCH 40/47] Changed prebuild stage of nswag generation script Signed-off-by: Andrei de la Cruz --- .../OpenFeature.Contrib.Providers.Flipt.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj b/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj index 65cd4f4b..6e3d4e32 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj +++ b/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj @@ -24,14 +24,14 @@ - + latest - + From 632210b4ae77e53a29dbd813f420ceeb266cb87e Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Thu, 17 Oct 2024 14:34:13 +0200 Subject: [PATCH 41/47] Use nswag msbuild variables in creating clients Signed-off-by: Andrei de la Cruz --- .../OpenFeature.Contrib.Providers.Flipt.csproj | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj b/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj index 6e3d4e32..c2f50260 100644 --- a/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj +++ b/src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj @@ -22,6 +22,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + @@ -31,7 +35,7 @@ latest - - + + From 92be761d286cf5027c717d2501b7a51da15c52da Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Thu, 17 Oct 2024 14:43:14 +0200 Subject: [PATCH 42/47] Fix System.Http reference in tests Signed-off-by: Andrei de la Cruz --- .../OpenFeature.Contrib.Providers.Flipt.Test.csproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj b/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj index 8e41387a..763c0745 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj @@ -14,5 +14,9 @@ + + + + From 06584f73808d23e22c85d225e6a148cd476d5a46 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Thu, 17 Oct 2024 14:58:00 +0200 Subject: [PATCH 43/47] Fix import errors on dotnet version 462 Signed-off-by: Andrei de la Cruz --- .../FliptToOpenFeatureConverterTest.cs | 7 +------ .../OpenFeature.Contrib.Providers.Flipt.Test.csproj | 9 +++++---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs index 2e41215b..73ffd7ca 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs @@ -130,12 +130,7 @@ public async Task EvaluateAsync_GivenExistingVariantFlagAndWithAnObject_ShouldRe { const string flagKey = "variant-flag"; const string variantKey = "variant-A"; - const string valueFromSrc = """ - { - "name": "Mr. Robinson", - "age": 12, - } - """; + const string valueFromSrc = """{"name": "Mr.Robinson", "age": 12 }"""; var expectedValue = new Value(new Structure(new Dictionary { { "name", new Value("Mr. Robinson") }, { "age", new Value(12) } diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj b/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj index 763c0745..2ea46b29 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj @@ -9,14 +9,15 @@ latest + + + + - - - - + From 6a1f64cba6522778b4f720849bc15e99d2f63b99 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Thu, 17 Oct 2024 15:04:26 +0200 Subject: [PATCH 44/47] Fix failing unit test caused by lint Signed-off-by: Andrei de la Cruz --- .../FliptToOpenFeatureConverterTest.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs index 73ffd7ca..7ac199b6 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs @@ -1,4 +1,5 @@ using System.Net; +using System.Net.Http; using Flipt.Rest; using FluentAssertions; using Moq; @@ -130,7 +131,12 @@ public async Task EvaluateAsync_GivenExistingVariantFlagAndWithAnObject_ShouldRe { const string flagKey = "variant-flag"; const string variantKey = "variant-A"; - const string valueFromSrc = """{"name": "Mr.Robinson", "age": 12 }"""; + const string valueFromSrc = """ + { + "name": "Mr. Robinson", + "age": 12, + } + """; var expectedValue = new Value(new Structure(new Dictionary { { "name", new Value("Mr. Robinson") }, { "age", new Value(12) } From 5312d5350bceaace7a69df0c42536305e4820466 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Thu, 17 Oct 2024 15:17:27 +0200 Subject: [PATCH 45/47] lint Signed-off-by: Andrei de la Cruz --- .../FliptToOpenFeatureConverterTest.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs index 7ac199b6..99573a06 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs @@ -131,12 +131,12 @@ public async Task EvaluateAsync_GivenExistingVariantFlagAndWithAnObject_ShouldRe { const string flagKey = "variant-flag"; const string variantKey = "variant-A"; - const string valueFromSrc = """ + const string valueFromSrc = """ { - "name": "Mr. Robinson", + "name": "Mr. Robinson", "age": 12, } - """; + """; var expectedValue = new Value(new Structure(new Dictionary { { "name", new Value("Mr. Robinson") }, { "age", new Value(12) } From 37e35afa7f11088520f0477febb6179391dbce74 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Fri, 18 Oct 2024 10:54:29 +0200 Subject: [PATCH 46/47] Fix warnings regarding unused theory params in xunit Signed-off-by: Andrei de la Cruz --- .../FliptToOpenFeatureConverterTest.cs | 48 ++++++++++--------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs index 99573a06..905384c7 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs @@ -1,3 +1,5 @@ +// ReSharper disable RedundantUsingDirective + using System.Net; using System.Net.Http; using Flipt.Rest; @@ -14,13 +16,13 @@ public class FliptToOpenFeatureConverterTest { // EvaluateBooleanAsync Tests [Theory] - [InlineData(HttpStatusCode.NotFound, ErrorType.FlagNotFound, false)] - [InlineData(HttpStatusCode.BadRequest, ErrorType.TypeMismatch, false)] - [InlineData(HttpStatusCode.InternalServerError, ErrorType.ProviderNotReady, false)] - [InlineData(HttpStatusCode.Forbidden, ErrorType.ProviderNotReady, false)] - [InlineData(HttpStatusCode.Ambiguous, ErrorType.General, false)] + [InlineData(HttpStatusCode.NotFound, false)] + [InlineData(HttpStatusCode.BadRequest, false)] + [InlineData(HttpStatusCode.InternalServerError, false)] + [InlineData(HttpStatusCode.Forbidden, false)] + [InlineData(HttpStatusCode.Ambiguous, false)] public async Task EvaluateBooleanAsync_GivenHttpRequestException_ShouldHandleHttpRequestException( - HttpStatusCode thrownStatusCode, ErrorType expectedOpenFeatureErrorType, bool fallbackValue) + HttpStatusCode thrownStatusCode, bool fallbackValue) { var mockFliptClientWrapper = new Mock(); mockFliptClientWrapper.Setup(fcw => @@ -28,7 +30,7 @@ public async Task EvaluateBooleanAsync_GivenHttpRequestException_ShouldHandleHtt .ThrowsAsync(new FliptRestException("", (int)thrownStatusCode, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); - var resolution = async Task>() => + var resolution = async Task> () => await fliptToOpenFeature.EvaluateBooleanAsync("flagKey", fallbackValue); await resolution.Should().ThrowAsync(); @@ -68,8 +70,8 @@ public async Task EvaluateBooleanAsync_GivenNonExistentFlag_ShouldReturnDefaultV .ThrowsAsync(new FliptRestException("", (int)HttpStatusCode.NotFound, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); - var resolution = async Task>() => - await fliptToOpenFeature.EvaluateBooleanAsync("flagKey", fallBackValue); + var resolution = async Task> () => + await fliptToOpenFeature.EvaluateBooleanAsync(flagKey, fallBackValue); await resolution.Should().ThrowAsync(); } @@ -77,13 +79,13 @@ public async Task EvaluateBooleanAsync_GivenNonExistentFlag_ShouldReturnDefaultV // EvaluateAsync Tests [Theory] - [InlineData(HttpStatusCode.NotFound, ErrorType.FlagNotFound, 0.0)] - [InlineData(HttpStatusCode.BadRequest, ErrorType.TypeMismatch, 0.0)] - [InlineData(HttpStatusCode.InternalServerError, ErrorType.ProviderNotReady, 0.0)] - [InlineData(HttpStatusCode.Forbidden, ErrorType.ProviderNotReady, 0.0)] - [InlineData(HttpStatusCode.Ambiguous, ErrorType.General, 0.0)] + [InlineData(HttpStatusCode.NotFound, 0.0)] + [InlineData(HttpStatusCode.BadRequest, 0.0)] + [InlineData(HttpStatusCode.InternalServerError, 0.0)] + [InlineData(HttpStatusCode.Forbidden, 0.0)] + [InlineData(HttpStatusCode.Ambiguous, 0.0)] public async Task EvaluateAsync_GivenHttpRequestException_ShouldHandleHttpRequestException( - HttpStatusCode thrownStatusCode, ErrorType expectedOpenFeatureErrorType, double fallbackValue) + HttpStatusCode thrownStatusCode, double fallbackValue) { var mockFliptClientWrapper = new Mock(); mockFliptClientWrapper.Setup(fcw => @@ -91,7 +93,7 @@ public async Task EvaluateAsync_GivenHttpRequestException_ShouldHandleHttpReques .ThrowsAsync(new FliptRestException("", (int)thrownStatusCode, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); - var resolution = async Task>() => + var resolution = async Task> () => await fliptToOpenFeature.EvaluateAsync("flagKey", fallbackValue); await resolution.Should().ThrowAsync(); @@ -132,11 +134,11 @@ public async Task EvaluateAsync_GivenExistingVariantFlagAndWithAnObject_ShouldRe const string flagKey = "variant-flag"; const string variantKey = "variant-A"; const string valueFromSrc = """ - { - "name": "Mr. Robinson", - "age": 12, - } - """; + { + "name": "Mr. Robinson", + "age": 12, + } + """; var expectedValue = new Value(new Structure(new Dictionary { { "name", new Value("Mr. Robinson") }, { "age", new Value(12) } @@ -177,7 +179,7 @@ public async Task .ThrowsAsync(new FliptRestException("", (int)HttpStatusCode.NotFound, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); - var resolution = async Task>() => + var resolution = async Task> () => await fliptToOpenFeature.EvaluateAsync("non-existent-flag", fallbackValue); await resolution.Should().ThrowAsync(); @@ -194,7 +196,7 @@ public async Task .ThrowsAsync(new FliptRestException("", (int)HttpStatusCode.NotFound, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); - var resolution = async Task>() => + var resolution = async Task> () => await fliptToOpenFeature.EvaluateAsync("non-existent-flag", fallbackValue); await resolution.Should().ThrowAsync(); From ed51049d98f00b8a50ee88a04827c5db05789ee6 Mon Sep 17 00:00:00 2001 From: Andrei de la Cruz Date: Fri, 18 Oct 2024 11:00:35 +0200 Subject: [PATCH 47/47] lint Signed-off-by: Andrei de la Cruz --- .../FliptToOpenFeatureConverterTest.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs index cf4b1c69..cdc12a9f 100644 --- a/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flipt.Test/FliptToOpenFeatureConverterTest.cs @@ -30,7 +30,7 @@ public async Task EvaluateBooleanAsync_GivenHttpRequestException_ShouldHandleHtt .ThrowsAsync(new FliptRestException("", (int)thrownStatusCode, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); - var resolution = async Task> () => + var resolution = async Task>() => await fliptToOpenFeature.EvaluateBooleanAsync("flagKey", fallbackValue); await resolution.Should().ThrowAsync(); @@ -70,7 +70,7 @@ public async Task EvaluateBooleanAsync_GivenNonExistentFlag_ShouldReturnDefaultV .ThrowsAsync(new FliptRestException("", (int)HttpStatusCode.NotFound, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); - var resolution = async Task> () => + var resolution = async Task>() => await fliptToOpenFeature.EvaluateBooleanAsync(flagKey, fallBackValue); await resolution.Should().ThrowAsync(); @@ -93,7 +93,7 @@ public async Task EvaluateAsync_GivenHttpRequestException_ShouldHandleHttpReques .ThrowsAsync(new FliptRestException("", (int)thrownStatusCode, "", null, null)); var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object); - var resolution = async Task> () => + var resolution = async Task>() => await fliptToOpenFeature.EvaluateAsync("flagKey", fallbackValue); await resolution.Should().ThrowAsync();