Typed HTTP API
Call Fluxer REST endpoints through Rust models and structured errors instead of untyped JSON plumbing.
Rust API wrapper for Fluxer
refluxer gives you a typed REST client, WebSocket gateway, event handlers, shared bot context, Fluxer models, permissions, IDs, and snowflake support without pulling in more runtime than you need.
If refluxer looks useful, a GitHub star helps other Fluxer developers find it. Star the project
let client = Client::builder()
.token(&token)
.event_handler(Handler)
.build()?;
client.start().awaitInstall
Use the default HTTP client for API work, or enable the high-level client for gateway events and bot handlers.
cargoaddrefluxer--featuresclient[dependencies]
refluxer = { version = "0.2", features = ["client"] }
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
async-trait = "0.1"What it ships
Call Fluxer REST endpoints through Rust models and structured errors instead of untyped JSON plumbing.
Receive WebSocket events through typed dispatch, heartbeat handling, session resume, and client-level reconnect backoff.
Register event handlers, receive a shared context, and send replies from the same async flow.
Use models, permissions, IDs, and snowflakes that mirror the platform instead of scattering primitives everywhere.
Quick start
The high-level client lets the gateway event become normal Rust control flow.
use refluxer::model::message::Message;
use refluxer::{Client, Context, EventHandler};
struct Handler;
#[async_trait::async_trait]
impl EventHandler for Handler {
async fn message_create(&self, ctx: Context, msg: Message) {
if msg.author.bot.unwrap_or(false) {
return;
}
if msg.content == "!ping" {
ctx.send_message(msg.channel_id, "Pong!").await.ok();
}
}
}
#[tokio::main]
async fn main() -> Result<(), refluxer::Error> {
let token = std::env::var("FLUXER_TOKEN")
.expect("FLUXER_TOKEN env var required");
let client = Client::builder()
.token(&token)
.event_handler(Handler)
.build()?;
client.start().await
}Feature flags
httpREST client and shared modelsyesgatewayWebSocket gateway support, includes httpnoclientHigh-level bot framework, includes gatewaynoExamples
cargo run -p refluxer --example http_onlycargo run -p refluxer --example ping_bot --features clientcargo run --manifest-path examples/gitbot/Cargo.toml