LavinmqEx

CI Hex.pm Documentation

A compact, generated, Req-backed Elixir client for the LavinMQ HTTP management API.

The client exposes all 109 operations in the generated OpenAPI specification. It supports explicit clients for dynamic credentials and a configured, Repo-style module for the common single-server case.

Installation

Add lavinmq_ex to your dependencies:

def deps do
[
{:lavinmq_ex, "~> 0.1.0"}
]
end

Explicit client

client =
LavinmqEx.new(
base_url: "http://localhost:15672/api",
username: "guest",
password: "guest"
)
{:ok, response} = LavinmqEx.Queues.get_queues(client)

Resource modules include LavinmqEx.Queues, LavinmqEx.Exchanges, LavinmqEx.Users, LavinmqEx.Vhosts, and the other OpenAPI tags.

Path values are URL encoded. Query parameters are passed as maps, request bodies as maps, and the final optional argument is a Req options keyword list. HTTP responses, including non-2xx responses, return as {:ok, Req.Response.t()}; transport failures return {:error, exception}.

Configured module

defmodule MyApp.LavinMQ do
use LavinmqEx, otp_app: :my_app
end
# config/runtime.exs
config :my_app, MyApp.LavinMQ,
base_url: "http://localhost:15672/api",
username: System.fetch_env!("LAVINMQ_USERNAME"),
password: System.fetch_env!("LAVINMQ_PASSWORD")

The configured module exposes client-free wrappers:

{:ok, response} = MyApp.LavinMQ.get_queues()

See docs/rest-api-reference.md for every operation and both calling styles.

Regeneration

The TypeScript OpenAPI definition and copied client generator live in generator/:

cd generator
bun install
bun run generate
bun run check

This regenerates generator/generated/openapi.yaml, lib/lavinmq_ex/generated/, and the Markdown API reference.

License

MIT License. See the license file.