mirror of
https://github.com/bitwarden/server
synced 2026-01-07 11:03:37 +00:00
Establish IFeatureService as scoped (#3679)
* Establish IFeatureService as scoped * Lint * Feedback around injection
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
using Bit.Core.Context;
|
||||
|
||||
namespace Bit.Core.Services;
|
||||
namespace Bit.Core.Services;
|
||||
|
||||
public interface IFeatureService
|
||||
{
|
||||
@@ -14,33 +12,29 @@ public interface IFeatureService
|
||||
/// Checks whether a given feature is enabled.
|
||||
/// </summary>
|
||||
/// <param name="key">The key of the feature to check.</param>
|
||||
/// <param name="currentContext">A context providing information that can be used to evaluate whether a feature should be on or off.</param>
|
||||
/// <param name="defaultValue">The default value for the feature.</param>
|
||||
/// <returns>True if the feature is enabled, otherwise false.</returns>
|
||||
bool IsEnabled(string key, ICurrentContext currentContext, bool defaultValue = false);
|
||||
bool IsEnabled(string key, bool defaultValue = false);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the integer variation of a feature.
|
||||
/// </summary>
|
||||
/// <param name="key">The key of the feature to check.</param>
|
||||
/// <param name="currentContext">A context providing information that can be used to evaluate the feature value.</param>
|
||||
/// <param name="defaultValue">The default value for the feature.</param>
|
||||
/// <returns>The feature variation value.</returns>
|
||||
int GetIntVariation(string key, ICurrentContext currentContext, int defaultValue = 0);
|
||||
int GetIntVariation(string key, int defaultValue = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the string variation of a feature.
|
||||
/// </summary>
|
||||
/// <param name="key">The key of the feature to check.</param>
|
||||
/// <param name="currentContext">A context providing information that can be used to evaluate the feature value.</param>
|
||||
/// <param name="defaultValue">The default value for the feature.</param>
|
||||
/// <returns>The feature variation value.</returns>
|
||||
string GetStringVariation(string key, ICurrentContext currentContext, string defaultValue = null);
|
||||
string GetStringVariation(string key, string defaultValue = null);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all feature values.
|
||||
/// </summary>
|
||||
/// <param name="currentContext">A context providing information that can be used to evaluate the feature values.</param>
|
||||
/// <returns>A dictionary of feature keys and their values.</returns>
|
||||
Dictionary<string, object> GetAll(ICurrentContext currentContext);
|
||||
Dictionary<string, object> GetAll();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user