diff --git a/robot-server/robot_server/service/session/models/command.py b/robot-server/robot_server/service/session/models/command.py index f209dce4247..028942613a8 100644 --- a/robot-server/robot_server/service/session/models/command.py +++ b/robot-server/robot_server/service/session/models/command.py @@ -1,3 +1,21 @@ +"""Modeling of session commands. + +Creating a new command type requires these steps: +1) Creation of a CommandDefinition enum identifying the command +type. + +2) If necessary, define a data payload model. + +3) If necessary, define a result payload model. + +4) Create specialized `SessionCommandRequest` and `SessionCommandResponse` +types using the CommandDefinition Literal(s), data, and result payload models. +If there are no data and result models, then add the CommandDefinition to +`CommandsEmptyData` type. + +5) If not using `CommandsEmptyData` then add specialized request and response +types to `RequestTypes` and `ResponseTypes`. +""" from datetime import datetime from enum import Enum import typing diff --git a/robot-server/robot_server/service/session/models/command_definitions.py b/robot-server/robot_server/service/session/models/command_definitions.py index 0e82c95ca41..4ad568b06c5 100644 --- a/robot-server/robot_server/service/session/models/command_definitions.py +++ b/robot-server/robot_server/service/session/models/command_definitions.py @@ -1,8 +1,14 @@ +""" +Command type definitions. + +Definitions should be grouped into thematic namespaces. +""" import typing from enum import Enum class CommandDefinition(str, Enum): + """The base of command definition enumerations.""" def __new__(cls, value): """Create a string enum.""" namespace = cls.namespace() @@ -17,9 +23,9 @@ def __new__(cls, value): @staticmethod def namespace(): """ - This is primarily for allowing definitions to define a - namespace. The name space will be used to make the value of the - enum. It will be "{namespace}.{value}" + Override to create a namespoce for the member definitions. The + name.space will be used to make the value of the enum. It will + be "{namespace}.{value}" """ return None