Module twitch_api2::helix::users::block_user
source · [−]Available on crate feature
helix
only.Expand description
Blocks the specified user on behalf of the authenticated user.
block-user
Accessing the endpoint
Request: BlockUserRequest
To use this endpoint, construct a BlockUserRequest
with the BlockUserRequest::builder()
method.
use twitch_api2::helix::users::block_user::{self, Reason, SourceContext};
let request = block_user::BlockUserRequest::builder()
.target_user_id("1234")
.build();
// Or, specifying a reason for the block
let request = block_user::BlockUserRequest::builder()
.target_user_id("1234")
.source_context(SourceContext::Chat)
.reason(Reason::Spam)
.build();
Response: BlockUser
Send the request to receive the response with HelixClient::req_put()
.
use twitch_api2::helix::{self, users::block_user};
let request = block_user::BlockUserRequest::builder()
.target_user_id("1234")
.build();
let response: block_user::BlockUser = client.req_put(request, helix::EmptyBody, &token).await?.data;
You can also get the http::Request
with request.create_request(&token, &client_id)
and parse the http::Response
with BlockUserRequest::parse_response(None, &request.get_uri(), response)
Structs
Query Parameters for Block User