Available on crate feature helix only.
Expand description

Create a single scheduled broadcast or a recurring scheduled broadcast for a channel’s stream schedule. create-channel-stream-schedule-segment

Accessing the endpoint

Request: CreateChannelStreamScheduleSegmentRequest

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

use twitch_api2::helix::schedule::create_channel_stream_schedule_segment;
let request =
    create_channel_stream_schedule_segment::CreateChannelStreamScheduleSegmentRequest::builder(
    )
    .broadcaster_id("141981764")
    .build();

Body: CreateChannelStreamScheduleSegmentBody

We also need to provide a body to the request containing what we want to change.

let body =
    create_channel_stream_schedule_segment::CreateChannelStreamScheduleSegmentBody::builder()
        .start_time(twitch_api2::types::Timestamp::new("2021-07-01T18:00:00Z").unwrap())
        .timezone("America/New_York")
        .is_recurring(false)
        .duration("60".to_string())
        .category_id(Some("509670".into()))
        .title("TwitchDev Monthly Update // July 1, 2021".to_string())
        .build();

Response: ScheduledBroadcasts

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

use twitch_api2::helix::{self, schedule::create_channel_stream_schedule_segment};
let request = create_channel_stream_schedule_segment::CreateChannelStreamScheduleSegmentRequest::builder()
    .broadcaster_id("141981764")
    .build();
let body = create_channel_stream_schedule_segment::CreateChannelStreamScheduleSegmentBody::builder()
    .start_time(twitch_api2::types::Timestamp::new("2021-07-01T18:00:00Z").unwrap())
    .timezone("America/New_York")
    .is_recurring(false)
    .duration("60".to_string())
    .category_id(Some("509670".into()))
    .title("TwitchDev Monthly Update // July 1, 2021".to_string())
    .build();
let response: create_channel_stream_schedule_segment::CreateChannelStreamScheduleSegmentResponse = client.req_post(request, body, &token).await?.data;

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

Structs

Type Definitions