Expand description
Typed request builders, multipart form support, a manual request builder for low-level request construction, and audit log reason support.
§Request Builders
Requests are created in the form of builders. These can be await
ed to
receive a Response
. Every route of Discord’s API has its own builder:
creating a message is performed via the CreateMessage
builder; updating
a guild is done via UpdateGuild
; and so on. All typed request builders
are instantiated via the primary Client
. When the library doesn’t yet
support a new feature or fine-grained support is required, requests can be
manually built via RequestBuilder
.
§Audit Log Reasons
Audit log reasons can be added to supported requests via the
AuditLogReason
trait:
use twilight_http::{client::Client, request::AuditLogReason};
let client = Client::new(std::env::var("DISCORD_TOKEN")?);
client
.delete_ban(guild_id, user_id)
.reason("ban expired")
.await?;
Modules§
- Request builders for interacting with scheduled events.
Structs§
- Retrieve information about the current OAuth2 authorization.
- Get information about the gateway, optionally with additional information detailing the number of shards to use and sessions remaining.
- Get information about the gateway, authenticated as a bot user.
- Get a list of voice regions that can be used when creating a guild.
- Builder to create a customized request.
- Update the current user’s application.
Enums§
- HTTP request method.
Traits§
- Attach a reason for a request.
- Convert a typed request builder into a raw
Request
.