Struct twitch_api::helix::channels::modify_channel_information::ModifyChannelInformationBody
source · [−]#[non_exhaustive]pub struct ModifyChannelInformationBody<'a> {
pub game_id: Option<Cow<'a, CategoryIdRef>>,
pub broadcaster_language: Option<Cow<'a, str>>,
pub title: Option<Cow<'a, str>>,
}
Available on crate feature
helix
only.Expand description
Body Parameters for Modify Channel Information
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.game_id: Option<Cow<'a, CategoryIdRef>>
Current game ID being played on the channel. Use “0” or “” (an empty string) to unset the game.
broadcaster_language: Option<Cow<'a, str>>
Language of the channel
title: Option<Cow<'a, str>>
Title of the stream. Value must not be an empty string.
Implementations
sourceimpl<'a> ModifyChannelInformationBody<'a>
impl<'a> ModifyChannelInformationBody<'a>
sourcepub fn builder() -> ModifyChannelInformationBodyBuilder<'a, ((), (), ())>
pub fn builder() -> ModifyChannelInformationBodyBuilder<'a, ((), (), ())>
Create a builder for building ModifyChannelInformationBody
.
On the builder, call .game_id(...)
(optional), .broadcaster_language(...)
(optional), .title(...)
(optional) to set the values of the fields.
Finally, call .build()
to create the instance of ModifyChannelInformationBody
.
sourceimpl<'a> ModifyChannelInformationBody<'a>
impl<'a> ModifyChannelInformationBody<'a>
sourcepub fn new() -> Self
pub fn new() -> Self
Examples found in repository?
examples/modify_channel.rs (line 39)
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
async fn run() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
let _ = dotenvy::dotenv();
let mut args = std::env::args().skip(1);
let client: HelixClient<reqwest::Client> = HelixClient::new();
let token = UserToken::from_existing(
&client,
std::env::var("TWITCH_TOKEN")
.ok()
.or_else(|| args.next())
.map(AccessToken::new)
.expect("Please set env: TWITCH_TOKEN or pass token as first argument"),
None,
None,
)
.await?;
let broadcaster_id = token.validate_token(&client).await?.user_id.unwrap();
let req = twitch_api::helix::channels::ModifyChannelInformationRequest::broadcaster_id(
&broadcaster_id,
);
let mut body = twitch_api::helix::channels::ModifyChannelInformationBody::new();
body.title("Hello World!");
println!("scopes: {:?}", token.scopes());
let response = client.req_patch(req, body, &token).await?;
println!("{:?}", response);
Ok(())
}
sourcepub fn game_id(
&mut self,
game_id: impl IntoCow<'a, CategoryIdRef> + 'a
) -> &mut Self
pub fn game_id(
&mut self,
game_id: impl IntoCow<'a, CategoryIdRef> + 'a
) -> &mut Self
Current game ID being played on the channel. Use “0” or “” (an empty string) to unset the game.
sourcepub fn broadcaster_language(
&mut self,
broadcaster_language: impl Into<Cow<'a, str>>
) -> &mut Self
pub fn broadcaster_language(
&mut self,
broadcaster_language: impl Into<Cow<'a, str>>
) -> &mut Self
Language of the channel
sourcepub fn title(&mut self, title: impl Into<Cow<'a, str>>) -> &mut Self
pub fn title(&mut self, title: impl Into<Cow<'a, str>>) -> &mut Self
Title of the stream. Value must not be an empty string.
Examples found in repository?
examples/modify_channel.rs (line 40)
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
async fn run() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
let _ = dotenvy::dotenv();
let mut args = std::env::args().skip(1);
let client: HelixClient<reqwest::Client> = HelixClient::new();
let token = UserToken::from_existing(
&client,
std::env::var("TWITCH_TOKEN")
.ok()
.or_else(|| args.next())
.map(AccessToken::new)
.expect("Please set env: TWITCH_TOKEN or pass token as first argument"),
None,
None,
)
.await?;
let broadcaster_id = token.validate_token(&client).await?.user_id.unwrap();
let req = twitch_api::helix::channels::ModifyChannelInformationRequest::broadcaster_id(
&broadcaster_id,
);
let mut body = twitch_api::helix::channels::ModifyChannelInformationBody::new();
body.title("Hello World!");
println!("scopes: {:?}", token.scopes());
let response = client.req_patch(req, body, &token).await?;
println!("{:?}", response);
Ok(())
}
Trait Implementations
sourceimpl<'a> Clone for ModifyChannelInformationBody<'a>
impl<'a> Clone for ModifyChannelInformationBody<'a>
sourcefn clone(&self) -> ModifyChannelInformationBody<'a>
fn clone(&self) -> ModifyChannelInformationBody<'a>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl<'a> Debug for ModifyChannelInformationBody<'a>
impl<'a> Debug for ModifyChannelInformationBody<'a>
sourceimpl<'a> Default for ModifyChannelInformationBody<'a>
impl<'a> Default for ModifyChannelInformationBody<'a>
sourcefn default() -> ModifyChannelInformationBody<'a>
fn default() -> ModifyChannelInformationBody<'a>
Returns the “default value” for a type. Read more
sourceimpl<'de: 'a, 'a> Deserialize<'de> for ModifyChannelInformationBody<'a>
impl<'de: 'a, 'a> Deserialize<'de> for ModifyChannelInformationBody<'a>
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<'a> PartialEq<ModifyChannelInformationBody<'a>> for ModifyChannelInformationBody<'a>
impl<'a> PartialEq<ModifyChannelInformationBody<'a>> for ModifyChannelInformationBody<'a>
sourcefn eq(&self, other: &ModifyChannelInformationBody<'a>) -> bool
fn eq(&self, other: &ModifyChannelInformationBody<'a>) -> bool
sourceimpl<'a> Serialize for ModifyChannelInformationBody<'a>
impl<'a> Serialize for ModifyChannelInformationBody<'a>
impl<'a> Eq for ModifyChannelInformationBody<'a>
impl<'a> StructuralEq for ModifyChannelInformationBody<'a>
impl<'a> StructuralPartialEq for ModifyChannelInformationBody<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for ModifyChannelInformationBody<'a>
impl<'a> Send for ModifyChannelInformationBody<'a>
impl<'a> Sync for ModifyChannelInformationBody<'a>
impl<'a> Unpin for ModifyChannelInformationBody<'a>
impl<'a> UnwindSafe for ModifyChannelInformationBody<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.sourceimpl<T> HelixRequestBody for Twhere
T: Serialize + SealedSerialize,
impl<T> HelixRequestBody for Twhere
T: Serialize + SealedSerialize,
sourcefn try_to_body(&self) -> Result<Bytes, BodyError>
fn try_to_body(&self) -> Result<Bytes, BodyError>
Available on crate feature
helix
only.Create the body