Skip to content

Commit

Permalink
fix: make getvariant public (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonms90 authored Apr 6, 2022
1 parent fb5bf6e commit 910b39e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Unleash/DefaultUnleash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public Variant GetVariant(string toggleName, Variant defaultVariant)
return GetVariant(toggleName, services.ContextProvider.Context, defaultVariant);
}

private Variant GetVariant(string toggleName, UnleashContext context, Variant defaultValue)
public Variant GetVariant(string toggleName, UnleashContext context, Variant defaultValue)
{
var toggle = GetToggle(toggleName);

Expand Down
17 changes: 12 additions & 5 deletions src/Unleash/IUnleash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,28 @@ public interface IUnleash : IDisposable

/// <summary>
/// Get a weighted variant from a feature that is available.
/// Should be used with care, is not a sticky variant, will weight by call.
/// </summary>
/// <param name="toggleName">The name of the toggle</param>
/// <returns>A weighted variant or null if feature is not available</returns>
/// <returns>A weighted variant or Variant.DISABLED_VARIANT if feature is not available</returns>
Variant GetVariant(string toggleName);

/// <summary>
/// Get a weighted variant from a feature that is available.
/// Should be used with care, is not a sticky variant, will weight by call.
/// </summary>
/// <param name="toggleName">The name of the toggle</param>
/// <param name="defaultValue">If a toglge is not found, the default value will be returned. (Default: Variant.DISABLED_VARIANT)</param>
/// <returns>A weighted variant or null if feature is not available</returns>
/// <param name="defaultValue">If a toggle is not found, the default value will be returned.</param>
/// <returns>A weighted variant or the supplied default value if feature is not available</returns>
Variant GetVariant(string toggleName, Variant defaultValue);

/// <summary>
/// Get a weighted variant from a feature that is available.
/// </summary>
/// <param name="toggleName">The name of the toggle</param>
/// <param name="context">The Unleash context to evaluate the toggle state against</param>
/// <param name="defaultValue">If a toggle is not found, the default value will be returned.</param>
/// <returns>A weighted variant or the supplied default value if feature is not available</returns>
Variant GetVariant(string toggleName, UnleashContext context, Variant defaultValue);

IEnumerable<VariantDefinition> GetVariants(string toggleName);
}
}

0 comments on commit 910b39e

Please sign in to comment.