Module twitch_api2::helix::users::block_user[][src]

This is supported on crate feature helix only.

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, SourceContext, Reason};
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, &token).await?;

You can also get the http::Request with request.create_request(&token, &client_id) and parse the http::Response with request.parse_response(&request.get_uri()?)

Structs

BlockUserRequest

Query Parameters for Block User

Enums

BlockUser

Return Values for Block User

Reason

Reason for blocking the user.

SourceContext

Source context for blocking the user.