mm-api-ref-docs-fixes-wip
Changed .. note:: to .. remarks:: added missing `BotStatePropertyAcccessor` documentation
@@ -231,17 +231,41 @@ class BotState(PropertyManager):
cached_state.state[property_name] = value
-##
class BotStatePropertyAccessor(StatePropertyAccessor):
+ """
+ Defines methods for accessing a state property created in a :class:`BotState` object.
+ """
+
def __init__(self, bot_state: BotState, name: str):
+ """
+ Initializes a new instance of the :class:`BotStatePropertyAccessor` class.
+
+ :param bot_state: The state object to access
+ :type bot_state: :class:`BotState`
+ :param name: The name of the state property to access
+ :type name: str
+
+ """
self._bot_state = bot_state
self._name = name
@property
def name(self) -> str:
+ """
+ Gets the name of the property.
+
+ :return: The name of the property
+ :rtype: str
+ """
return self._name
async def delete(self, turn_context: TurnContext) -> None:
+ """
+ Deletes the property.
+
+ :param turn_context: The context object for this turn
+ :type turn_context: :class:`botbuilder.core.TurnContext`
+ """
await self._bot_state.load(turn_context, False)
await self._bot_state.delete_property_value(turn_context, self._name)
@@ -250,6 +274,14 @@ class BotStatePropertyAccessor(StatePropertyAccessor):
turn_context: TurnContext,
default_value_or_factory: Union[Callable, object] = None,
) -> object:
+ """
+ Gets the property value.
+
+ :param turn_context: The context object for this turn
+ :type turn_context: :class:`botbuilder.core.TurnContext`
+ :param default_value_or_factory: Defines the default value when no value is set for the property
+ :type default_value_or_factory: :typing:Union
+ """
await self._bot_state.load(turn_context, False)
try:
result = await self._bot_state.get_property_value(turn_context, self._name)
@@ -268,5 +300,14 @@ class BotStatePropertyAccessor(StatePropertyAccessor):
return result
async def set(self, turn_context: TurnContext, value: object) -> None:
+ """
+ Sets the property value.
+
+ :param turn_context: The context object for this turn
+ :type turn_context: :class:`botbuilder.core.TurnContext`
+
+ :param value: The value to assign to the property
+ :type value: :typing:`Object`
+ """
await self._bot_state.load(turn_context, False)
await self._bot_state.set_property_value(turn_context, self._name, value)
