Skip to content

Commit

Permalink
chore: minor formatting cleanup (#168)
Browse files Browse the repository at this point in the history
Signed-off-by: Austin Drenski <austin@austindrenski.io>
  • Loading branch information
austindrenski authored Jan 5, 2024
1 parent e8ca1da commit d0c25af
Showing 1 changed file with 44 additions and 42 deletions.
86 changes: 44 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,21 @@ dotnet add package OpenFeature

```csharp
public async Task Example()
{
// Register your feature flag provider
await Api.Instance.SetProvider(new InMemoryProvider());
{
// Register your feature flag provider
await Api.Instance.SetProvider(new InMemoryProvider());

// Create a new client
FeatureClient client = Api.Instance.GetClient();
// Create a new client
FeatureClient client = Api.Instance.GetClient();

// Evaluate your feature flag
bool v2Enabled = await client.GetBooleanValue("v2_enabled", false);
// Evaluate your feature flag
bool v2Enabled = await client.GetBooleanValue("v2_enabled", false);

if ( v2Enabled )
{
//Do some work
}
}
if ( v2Enabled )
{
//Do some work
}
}
```

## 🌟 Features
Expand Down Expand Up @@ -180,11 +180,13 @@ If a name has no associated provider, the global provider is used.
```csharp
// registering the default provider
await Api.Instance.SetProvider(new LocalProvider());

// registering a named provider
await Api.Instance.SetProvider("clientForCache", new CachedProvider());

// a client backed by default provider
FeatureClient clientDefault = Api.Instance.GetClient();
FeatureClient clientDefault = Api.Instance.GetClient();

// a client backed by CachedProvider
FeatureClient clientNamed = Api.Instance.GetClient("clientForCache");

Expand Down Expand Up @@ -213,37 +215,37 @@ You’ll then need to write the provider by implementing the `FeatureProvider` i

```csharp
public class MyProvider : FeatureProvider
{
public override Metadata GetMetadata()
{
return new Metadata("My Provider");
}

public override Task<ResolutionDetails<bool>> ResolveBooleanValue(string flagKey, bool defaultValue, EvaluationContext context = null)
{
public override Metadata GetMetadata()
{
return new Metadata("My Provider");
}

public override Task<ResolutionDetails<bool>> ResolveBooleanValue(string flagKey, bool defaultValue, EvaluationContext context = null)
{
// resolve a boolean flag value
}

public override Task<ResolutionDetails<double>> ResolveDoubleValue(string flagKey, double defaultValue, EvaluationContext context = null)
{
// resolve a double flag value
}

public override Task<ResolutionDetails<int>> ResolveIntegerValue(string flagKey, int defaultValue, EvaluationContext context = null)
{
// resolve an int flag value
}

public override Task<ResolutionDetails<string>> ResolveStringValue(string flagKey, string defaultValue, EvaluationContext context = null)
{
// resolve a string flag value
}

public override Task<ResolutionDetails<Value>> ResolveStructureValue(string flagKey, Value defaultValue, EvaluationContext context = null)
{
// resolve an object flag value
}
// resolve a boolean flag value
}

public override Task<ResolutionDetails<double>> ResolveDoubleValue(string flagKey, double defaultValue, EvaluationContext context = null)
{
// resolve a double flag value
}

public override Task<ResolutionDetails<int>> ResolveIntegerValue(string flagKey, int defaultValue, EvaluationContext context = null)
{
// resolve an int flag value
}

public override Task<ResolutionDetails<string>> ResolveStringValue(string flagKey, string defaultValue, EvaluationContext context = null)
{
// resolve a string flag value
}

public override Task<ResolutionDetails<Value>> ResolveStructureValue(string flagKey, Value defaultValue, EvaluationContext context = null)
{
// resolve an object flag value
}
}
```

### Develop a hook
Expand Down

0 comments on commit d0c25af

Please sign in to comment.