Module end_prediction

Source
Available on crate feature helix only.
Expand description

End a prediction that is currently active.

end-prediction

§Accessing the endpoint

§Request: EndPredictionRequest

To use this endpoint, construct an EndPredictionRequest with the EndPredictionRequest::new() method.

use twitch_api::helix::predictions::end_prediction;
let request = end_prediction::EndPredictionRequest::new();

§Body: EndPredictionBody

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

use twitch_api::helix::predictions::{self, end_prediction};
let body = end_prediction::EndPredictionBody::new(
    "141981764",
    "ed961efd-8a3f-4cf5-a9d0-e616c590cd2a",
    twitch_types::PredictionStatus::Resolved,
);

§Response: EndPrediction

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

use twitch_api::helix::{self, predictions::{self, end_prediction}};
let request = end_prediction::EndPredictionRequest::new();
let body = end_prediction::EndPredictionBody::new(
    "141981764",
    "ed961efd-8a3f-4cf5-a9d0-e616c590cd2a",
    twitch_types::PredictionStatus::Resolved
);
let response: end_prediction::EndPrediction = client.req_patch(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 EndPredictionRequest::parse_response(None, &request.get_uri(), response)

Structs§

EndPredictionBody
Body Parameters for End Prediction
EndPredictionRequest
Query Parameters for End Prediction

Enums§

EndPrediction
Return Values for Update CustomReward