Module request

Source
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 awaited 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§

application
attachment
channel
guild
poll
scheduled_event
Request builders for interacting with scheduled events.
sticker
template
user

Structs§

Form
GetCurrentAuthorizationInformation
Retrieve information about the current OAuth2 authorization.
GetGateway
Get information about the gateway, optionally with additional information detailing the number of shards to use and sessions remaining.
GetGatewayAuthed
Get information about the gateway, authenticated as a bot user.
GetUserApplicationInfo
GetVoiceRegions
Get a list of voice regions that can be used when creating a guild.
Request
RequestBuilder
Builder to create a customized request.
UpdateCurrentUserApplication
Update the current user’s application.

Enums§

Method
HTTP request method.

Traits§

AuditLogReason
Attach a reason for a request.
TryIntoRequest
Convert a typed request builder into a raw Request.