evercycle_api_runner.py ======================= .. module:: evercycle_api_runner Interactive menu-driven runner for the Evercycle API. Classes ------- .. py:class:: ApiEndpoint Same lightweight data class as in ``api_runner.py``. .. py:attribute:: path .. py:attribute:: description .. py:attribute:: method .. py:attribute:: url .. py:attribute:: content_type .. py:attribute:: headers .. py:attribute:: parameters .. py:attribute:: body_params .. py:attribute:: response_example .. py:attribute:: file_name .. py:class:: EvercycleApiRunner(api_dir="./") Interactive API runner. .. py:method:: load_endpoints() -> None Load all ``*.md`` files from ``api_dir``. .. py:method:: parse_markdown_file(file_path) -> ApiEndpoint | None Parse a markdown spec using the same rules as ``ApiRunner``. .. py:method:: display_menu() -> None Print a numbered list of endpoints and prompt the user to select one. Choice ``0`` exits the application. .. py:method:: prepare_api_call(endpoint) -> None Interactively collect parameters for the chosen endpoint and execute it. **Prompting order:** 1. **Headers** — one prompt per header declared in markdown. 2. **Path Parameters** — extracted from ``{...}`` placeholders in ``path``. 3. **Query Parameters** — one prompt per parameter declared in markdown. 4. **Body Parameters** — for POST/PUT/PATCH: * ``object``/``array`` types accept multi-line JSON input. * ``number`` types are coerced via ``float()`` (int if whole). * ``boolean`` types accept ``true/yes/1`` as True. * All other types are stored as strings. After collection, the method extracts the path from ``endpoint.url`` and calls ``ApiClient.call_endpoint()``. .. py:method:: run() -> None Main loop: repeatedly display the menu until the user exits. Functions --------- .. py:function:: main() Instantiate ``EvercycleApiRunner`` and start the interactive loop.