Available on crate feature helix only.
Expand description

Applies specified tags to a specified stream, overwriting any existing tags applied to that stream. If no tags are specified, all tags previously applied to the stream are removed. Automated tags are not affected by this operation. replace-stream-tags

Accessing the endpoint

Request: ReplaceStreamTagsRequest

To use this endpoint, construct a ReplaceStreamTagsRequest with the ReplaceStreamTagsRequest::builder() method.

use twitch_api2::helix::streams::replace_stream_tags;
let request = replace_stream_tags::ReplaceStreamTagsRequest::builder()
    .broadcaster_id("1234")
    .build();

Body: ReplaceStreamTagsBody

We also need to provide a body to the request containing the tags we want to set.

let body = replace_stream_tags::ReplaceStreamTagsBody::builder()
    .tag_ids(vec![
        "621fb5bf-5498-4d8f-b4ac-db4d40d401bf".into(),
        "79977fb9-f106-4a87-a386-f1b0f99783dd".into(),
    ])
    .build();

Response: ReplaceStreamTags

Send the request to receive the response with HelixClient::req_put().

use twitch_api2::helix::{self, streams::replace_stream_tags};
let request = replace_stream_tags::ReplaceStreamTagsRequest::builder()
    .broadcaster_id("1234")
    .build();
let body = replace_stream_tags::ReplaceStreamTagsBody::builder()
    .tag_ids(vec![
        "621fb5bf-5498-4d8f-b4ac-db4d40d401bf".into(),
        "79977fb9-f106-4a87-a386-f1b0f99783dd".into(),
    ])
    .build();
let response: replace_stream_tags::ReplaceStreamTags = client.req_put(request, body, &token).await?.data;

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

Structs

Enums