Create StyleRuleInfo from the given API JSON object.
(json)
| 941 | |
| 942 | @staticmethod |
| 943 | def from_json(json) -> "StyleRuleInfo": |
| 944 | """Create StyleRuleInfo from the given API JSON object.""" |
| 945 | configured_rules_data = json.get("configured_rules") |
| 946 | configured_rules = None |
| 947 | if configured_rules_data: |
| 948 | configured_rules = ConfiguredRules.from_json(configured_rules_data) |
| 949 | |
| 950 | custom_instructions_data = json.get("custom_instructions") |
| 951 | custom_instructions = None |
| 952 | if custom_instructions_data: |
| 953 | custom_instructions = [ |
| 954 | CustomInstruction.from_json(instruction) |
| 955 | for instruction in custom_instructions_data |
| 956 | ] |
| 957 | |
| 958 | return StyleRuleInfo( |
| 959 | style_id=json["style_id"], |
| 960 | name=json["name"], |
| 961 | creation_time=parse_timestamp(json["creation_time"]), |
| 962 | updated_time=parse_timestamp(json["updated_time"]), |
| 963 | language=json["language"], |
| 964 | version=json["version"], |
| 965 | configured_rules=configured_rules, |
| 966 | custom_instructions=custom_instructions, |
| 967 | ) |
| 968 | |
| 969 | @property |
| 970 | def style_id(self) -> str: |
nothing calls this directly
no test coverage detected