-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add FeatureProvider protocol (#268)
Signed-off-by: Federico Bond <federicobond@gmail.com>
- Loading branch information
1 parent
3b89760
commit caa7f36
Showing
5 changed files
with
74 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import typing | ||
|
||
from openfeature.evaluation_context import EvaluationContext | ||
from openfeature.flag_evaluation import FlagResolutionDetails | ||
from openfeature.hook import Hook | ||
|
||
from .metadata import Metadata | ||
|
||
|
||
class FeatureProvider(typing.Protocol): # pragma: no cover | ||
def initialize(self, evaluation_context: EvaluationContext) -> None: | ||
... | ||
|
||
def shutdown(self) -> None: | ||
... | ||
|
||
def get_metadata(self) -> Metadata: | ||
... | ||
|
||
def get_provider_hooks(self) -> typing.List[Hook]: | ||
... | ||
|
||
def resolve_boolean_details( | ||
self, | ||
flag_key: str, | ||
default_value: bool, | ||
evaluation_context: typing.Optional[EvaluationContext] = None, | ||
) -> FlagResolutionDetails[bool]: | ||
... | ||
|
||
def resolve_string_details( | ||
self, | ||
flag_key: str, | ||
default_value: str, | ||
evaluation_context: typing.Optional[EvaluationContext] = None, | ||
) -> FlagResolutionDetails[str]: | ||
... | ||
|
||
def resolve_integer_details( | ||
self, | ||
flag_key: str, | ||
default_value: int, | ||
evaluation_context: typing.Optional[EvaluationContext] = None, | ||
) -> FlagResolutionDetails[int]: | ||
... | ||
|
||
def resolve_float_details( | ||
self, | ||
flag_key: str, | ||
default_value: float, | ||
evaluation_context: typing.Optional[EvaluationContext] = None, | ||
) -> FlagResolutionDetails[float]: | ||
... | ||
|
||
def resolve_object_details( | ||
self, | ||
flag_key: str, | ||
default_value: typing.Union[dict, list], | ||
evaluation_context: typing.Optional[EvaluationContext] = None, | ||
) -> FlagResolutionDetails[typing.Union[dict, list]]: | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters