// AUTOMATICALLY GENERATED BY OPENFEATURE CLI, DO NOT EDIT. using System; using System.Collections.Generic; using System.Threading.Tasks; using OpenFeature; using OpenFeature.Model; namespace OpenFeature { /// /// Generated OpenFeature client for typesafe flag access /// public class GeneratedClient { private readonly IFeatureClient _client; /// /// Initializes a new instance of the class. /// /// The OpenFeature client to use for flag evaluations. public GeneratedClient(IFeatureClient client) { _client = client ?? throw new ArgumentNullException(nameof(client)); } /// /// Discount percentage applied to purchases. /// /// /// Flag key: discountPercentage /// Default value: 0.15 /// Type: float /// /// Optional context for the flag evaluation /// The flag value public async Task DiscountPercentageAsync(EvaluationContext evaluationContext = null) { return await _client.GetFloatValueAsync("discountPercentage", 0.15, evaluationContext); } /// /// Discount percentage applied to purchases. /// /// /// Flag key: discountPercentage /// Default value: 0.15 /// Type: float /// /// Optional context for the flag evaluation /// The evaluation details containing the flag value and metadata public async Task> DiscountPercentageDetailsAsync(EvaluationContext evaluationContext = null) { return await _client.GetFloatDetailsAsync("discountPercentage", 0.15, evaluationContext); } /// /// Controls whether Feature A is enabled. /// /// /// Flag key: enableFeatureA /// Default value: false /// Type: bool /// /// Optional context for the flag evaluation /// The flag value public async Task EnableFeatureAAsync(EvaluationContext evaluationContext = null) { return await _client.GetBoolValueAsync("enableFeatureA", false, evaluationContext); } /// /// Controls whether Feature A is enabled. /// /// /// Flag key: enableFeatureA /// Default value: false /// Type: bool /// /// Optional context for the flag evaluation /// The evaluation details containing the flag value and metadata public async Task> EnableFeatureADetailsAsync(EvaluationContext evaluationContext = null) { return await _client.GetBoolDetailsAsync("enableFeatureA", false, evaluationContext); } /// /// The message to use for greeting users. /// /// /// Flag key: greetingMessage /// Default value: Hello there! /// Type: string /// /// Optional context for the flag evaluation /// The flag value public async Task GreetingMessageAsync(EvaluationContext evaluationContext = null) { return await _client.GetStringValueAsync("greetingMessage", "Hello there!", evaluationContext); } /// /// The message to use for greeting users. /// /// /// Flag key: greetingMessage /// Default value: Hello there! /// Type: string /// /// Optional context for the flag evaluation /// The evaluation details containing the flag value and metadata public async Task> GreetingMessageDetailsAsync(EvaluationContext evaluationContext = null) { return await _client.GetStringDetailsAsync("greetingMessage", "Hello there!", evaluationContext); } /// /// Allows customization of theme colors. /// /// /// Flag key: themeCustomization /// Default value: new Value(Structure.Builder().Set("primaryColor", "#007bff").Set("secondaryColor", "#6c757d").Build()) /// Type: object /// /// Optional context for the flag evaluation /// Options for flag evaluation /// The flag value public async Task ThemeCustomizationAsync(EvaluationContext? evaluationContext = null, FlagEvaluationOptions? options = null) { return await _client.GetObjectValueAsync("themeCustomization", new Value(Structure.Builder().Set("primaryColor", "#007bff").Set("secondaryColor", "#6c757d").Build()), evaluationContext, options); } /// /// Allows customization of theme colors. /// /// /// Flag key: themeCustomization /// Default value: new Value(Structure.Builder().Set("primaryColor", "#007bff").Set("secondaryColor", "#6c757d").Build()) /// Type: object /// /// Optional context for the flag evaluation /// Options for flag evaluation /// The evaluation details containing the flag value and metadata public async Task> ThemeCustomizationDetailsAsync(EvaluationContext? evaluationContext = null, FlagEvaluationOptions? options = null) { return await _client.GetObjectDetailsAsync("themeCustomization", new Value(Structure.Builder().Set("primaryColor", "#007bff").Set("secondaryColor", "#6c757d").Build()), evaluationContext, options); } /// /// Maximum allowed length for usernames. /// /// /// Flag key: usernameMaxLength /// Default value: 50 /// Type: int /// /// Optional context for the flag evaluation /// The flag value public async Task UsernameMaxLengthAsync(EvaluationContext evaluationContext = null) { return await _client.GetIntValueAsync("usernameMaxLength", 50, evaluationContext); } /// /// Maximum allowed length for usernames. /// /// /// Flag key: usernameMaxLength /// Default value: 50 /// Type: int /// /// Optional context for the flag evaluation /// The evaluation details containing the flag value and metadata public async Task> UsernameMaxLengthDetailsAsync(EvaluationContext evaluationContext = null) { return await _client.GetIntDetailsAsync("usernameMaxLength", 50, evaluationContext); } /// /// Creates a new GeneratedClient using the default OpenFeature client /// /// A new GeneratedClient instance public static GeneratedClient CreateClient() { return new GeneratedClient(Api.GetClient()); } /// /// Creates a new GeneratedClient using a domain-specific OpenFeature client /// /// The domain to get the client for /// A new GeneratedClient instance public static GeneratedClient CreateClient(string domain) { return new GeneratedClient(Api.GetClient(domain)); } /// /// Creates a new GeneratedClient using a domain-specific OpenFeature client with context /// /// The domain to get the client for /// Default context to use for evaluations /// A new GeneratedClient instance public static GeneratedClient CreateClient(string domain, EvaluationContext evaluationContext) { return new GeneratedClient(Api.GetClient(domain, evaluationContext)); } } }