Module start_commercial

Source
Available on crate feature helix only.
Expand description

Starts a commercial on a specified channel. start-commercial

§Accessing the endpoint

§Request: StartCommercialRequest

To use this endpoint, construct a StartCommercialRequest with the StartCommercialRequest::new() method.

use twitch_api::helix::channels::start_commercial;
let request = start_commercial::StartCommercialRequest::new();

§Body: StartCommercialBody

We also need to provide a body to the request specifying length of commercial and where to start it.

let body = start_commercial::StartCommercialBody::new(
    "1234",
    twitch_api::types::CommercialLength::Length90,
);

§Response: StartCommercialRequest

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

use twitch_api::helix::{self, channels::start_commercial};
let request = start_commercial::StartCommercialRequest::new();
let body = start_commercial::StartCommercialBody::new("1234", twitch_api::types::CommercialLength::Length90);
let response: Vec<start_commercial::StartCommercial> = 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 StartCommercialRequest::parse_response(None, &request.get_uri(), response)

Structs§

StartCommercial
Return Values for Start Commercial
StartCommercialBody
Body Parameters for Start Commercial
StartCommercialRequest
Query Parameters for Start Commercial