diff --git a/api/s13_controls.py b/api/s13_controls.py index 1deda79..6173167 100644 --- a/api/s13_controls.py +++ b/api/s13_controls.py @@ -24,3 +24,19 @@ def set_control_cache(name: str, cs: ChangeSet) -> SqlChangeSet: def set_control(name: str, cs: ChangeSet) -> ChangeSet: return execute_command(name, set_control_cache(name, cs)) + + +class InpControl: + def __init__(self, section) -> None: + self.control = '\n'.join(section) + + +def inp_in_control(section: list[str]) -> ChangeSet: + obj = InpControl(section) + cs = ChangeSet({'operation' : API_UPDATE, 'type': 'control', 'control' : obj.control}) + return cs + + +def inp_out_control(name: str) -> list[str]: + obj = str(get_control(name)['control']) + return obj.split('\n')