Arksine / moonraker

Web API Server for Klipper
https://moonraker.readthedocs.io
GNU General Public License v3.0
1.05k stars 406 forks source link

Internal endpoint refactoring, handler optimizations #771

Closed Arksine closed 9 months ago

Arksine commented 9 months ago

This pull request represents significant refactoring of some of Moonraker's internals. The goal is to prepare Moonraker for future additions such as:

An overview of the items changed:

1) Use Python enums and flags in place of strings where appropriate. This includes HTTP request methods (ie: GET, POST), tranport types (HTTP, WEBSOCKET, etc), Klippy State, and Job State.

2) Emit a single internal event for job state changes. The legacy events remain in place for now.

3) Optimize endpoint registration to use shared API Definitions for all transports. Previously

4) Use a single instance of the JsonRPC class across all transports.

I have been testing this branch for a few weeks and believe that I have squashed any outstanding issues/regressions. That said, I only test against official Moonraker components. Developers and users who use optional components such as timelapse may wish to test this branch.

As of right now I intent to merge around the end of the week, presuming no regressions are discovered.