Skip to content

Latest commit

 

History

History
53 lines (39 loc) · 1.98 KB

File metadata and controls

53 lines (39 loc) · 1.98 KB

Contributing

The method surface is generated, not hand-written

The API exposes 122 client actions across 130 paths. The n8n node and the MCP tools are generated from storage/swagger.json, which is why both stay current, while a hand-maintained SDK falls behind — the Laravel SDK named 25 of 122 actions before its methods were generated.

GenerateSdkMethods in the proxy repository emits them, with a python and a python-async flavour:

python3 scripts/sync_actions.py ../eazewhatsapp-proxy
# wrote 122 sync and 122 async methods, and 122 tests

That overwrites two files whole, and nothing hand-written lives in either:

  • src/waapi/_generated.pyGeneratedActions and GeneratedAsyncActions
  • tests/test_generated_actions.py — one payload test per action

The script refuses to write if the two surfaces come out at different sizes or if the generator emitted nothing, and it runs ruff over its own output, so a file marked DO NOT EDIT never needs a human to fix its formatting.

Hand-written methods live in src/waapi/_actions.py, which composes the generated classes in. Add one there only if it cannot come from the spec — the instance endpoints are the current example, because they are ordinary REST routes rather than client actions. Anything added by hand is one more place a future API change has to reach.

If you do add one, mirror it in both ActionsMixin and AsyncActionsMixintest_sync_and_async_expose_the_same_methods fails otherwise, on purpose.

Conventions

  • Public arguments are snake_case; the JSON keys they map to stay camelCase as the API defines them.
  • Optional arguments default to None and are dropped from the payload by prune(). Do not send explicit nulls.
  • Anything that can be checked without a request (a missing instance id, a media call with no source) raises ValueError before the call goes out.

Tests

pip install -e ".[dev]"
pytest

No test may touch the network. Use httpx.MockTransport.