Instantiate a CDP command from a JSON object.
(cls, command, domain)
| 594 | |
| 595 | @classmethod |
| 596 | def from_json(cls, command, domain) -> "CdpCommand": |
| 597 | """Instantiate a CDP command from a JSON object.""" |
| 598 | parameters = command.get("parameters", []) |
| 599 | returns = command.get("returns", []) |
| 600 | |
| 601 | return cls( |
| 602 | command["name"], |
| 603 | command.get("description"), |
| 604 | command.get("experimental", False), |
| 605 | command.get("deprecated", False), |
| 606 | [cast(CdpParameter, CdpParameter.from_json(p)) for p in parameters], |
| 607 | [cast(CdpReturn, CdpReturn.from_json(r)) for r in returns], |
| 608 | domain, |
| 609 | ) |
| 610 | |
| 611 | def generate_code(self): |
| 612 | """Generate code for a CDP command.""" |