Raw Access, Still Typed
Typed calls to the routes that accept a bot token and typed raw gateway events, under Fluxer's own field names

Every Route That Takes a Bot Token
The client.rest.call method reaches a route of Fluxer's API that has no named method. The route is written the way Fluxer's documentation writes it, as its method and path template, and the editor offers every route that accepts a bot token
The params, query and body take Fluxer's own field names, and the response body has the route's type. A misspelled field, a missing required field or a route that is not listed fails to compile. The types come from Fluxer's OpenAPI document at the Fluxer commit the SDK pins
The types check what the bot sends, not what Fluxer answers
Call a Route Without a Methodimport type { Client } from "@neontechspace/fluxerly"export async function latestContents(client: Client, channelId: string) { const result = await client.rest.call("GET /channels/{channel_id}/messages", { params: { channel_id: channelId }, query: { limit: 10 }, }) return result.map((response) => response.body.map((message) => message.content)) }Routes Newer Than the SDK
The client.rest.request method sends a route or field Fluxer added after the pinned commit, or a route that needs no token, such as this public application read. Its type argument only names the expected body, so each field is checked before it is used
Both methods send through the same queue, rate limits, deadline and logging as the named methods. A non-2xx answer fails the Result with RestRequestError, and invalid input fails before anything is sent
import type { Client } from "@neontechspace/fluxerly"export async function applicationName(client: Client, applicationId: string) { const result = await client.rest.request<{ name?: unknown }>({ method: "GET", path: `/oauth2/applications/${applicationId}/public`, }) return result.map((response) => (typeof response.body.name === "string" ? response.body.name : undefined)) }Gateway Events in Fluxer's Own Form
Each gateway event the bot receives also arrives as the raw event, as Fluxer sent it. When documented is true, comparing t with a dispatch type gives d that type's documented fields, so a misspelled field fails to compile
The types come from Fluxer's gateway documentation and check nothing at runtime. A dispatch type the documentation does not describe still arrives, with documented: false and a d to validate
import type { Client } from "@neontechspace/fluxerly"export function watchOwnThreadMembership(client: Client) { return client.on("raw", (dispatch) => { if (!dispatch.documented || dispatch.t !== "THREAD_MEMBER_UPDATE") return console.log(`The bot's membership of thread ${dispatch.d.id} in guild ${dispatch.d.guild_id} changed`) })}
