Struct twilight_http::request::RequestBuilder[][src]

pub struct RequestBuilder(_);
Expand description

Builder to create a customized request.

Examples

Create a request to create a message with a content of “test” in a channel with an ID of 1:

use twilight_http::{request::Request, routing::Route};

let body = br#"{
    "content": "test"
}"#.to_vec();

let request = Request::builder(Route::CreateMessage {
    channel_id: 1,
}).body(body).build();

Implementations

Create a new request builder.

Consume the builder, returning the built request.

Set the contents of the body.

Set the multipart form.

Set the headers to add.

Set the body, to be serialized as JSON.

Errors

Returns an ErrorType::Json error type if the value could not be serialized as JSON.

Whether to use the client’s authorization token in the request, if one is set.

This is primarily useful for executing webhooks.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.