Struct Client

Source
pub struct Client<T: TokenStorage> {
    pub client_id: String,
    pub client_secret: String,
    pub token: Token,
    pub http_client: Client,
    pub token_storage: T,
}

Fields§

§client_id: String§client_secret: String§token: Token§http_client: Client§token_storage: T

Implementations§

Source§

impl<T: TokenStorage> Client<T>

Source

pub async fn validate_token(&mut self) -> Result<()>

Source

pub async fn refresh_token(&mut self) -> Result<()>

Source

pub fn from_token_no_validation( client_id: String, client_secret: String, token_storage: T, token: Token, ) -> Client<T>

Source

pub async fn from_token( client_id: String, client_secret: String, token_storage: T, token: Token, ) -> Result<Client<T>>

Source

pub async fn from_get_app_token( client_id: String, client_secret: String, token_storage: T, ) -> Result<Client<T>>

Source

pub async fn from_authorization( client_id: String, client_secret: String, token_storage: T, code: String, redirect_uri: String, ) -> Result<Client<T>>

Source§

impl<T: TokenStorage> Client<T>

Source

pub async fn connect_chat( &mut self, channels: Vec<String>, ) -> Result<(IrcClient, IrcStream)>

Source§

impl<T: TokenStorage> Client<T>

Source

pub async fn connect_eventsub( &mut self, topics: Vec<(String, String)>, ) -> Result<Client>

Source§

impl<T: TokenStorage> Client<T>

Source

pub async fn http_request<T2: Serialize>( &mut self, method: Method, uri: String, data_json: Option<T2>, data_form: Option<String>, ) -> Result<Response>

Source

pub async fn request<T1: Serialize + Clone>( &mut self, method: Method, uri: String, data_json: Option<T1>, data_form: Option<String>, ) -> Result<Response>

Source

pub async fn request_result<T1: for<'de> Deserialize<'de>, T2: Serialize + Clone>( &mut self, method: Method, uri: String, data_json: Option<T2>, data_form: Option<String>, ) -> Result<T1>

Source

pub async fn get<T1: for<'de> Deserialize<'de>>( &mut self, uri: String, ) -> Result<T1>

Source

pub async fn post_empty(&mut self, uri: String) -> Result<()>

Source

pub async fn post_form<T1: for<'de> Deserialize<'de>>( &mut self, uri: String, data: String, ) -> Result<T1>

Source

pub async fn post_json<T1: for<'de> Deserialize<'de>, T2: Serialize + Clone>( &mut self, uri: String, data: T2, ) -> Result<T1>

Source

pub async fn post_json_empty<T1: Serialize + Clone>( &mut self, uri: String, data: T1, ) -> Result<()>

Source

pub async fn patch_json<T1: for<'de> Deserialize<'de>, T2: Serialize + Clone>( &mut self, uri: String, data: T2, ) -> Result<T1>

Source

pub async fn delete(&mut self, uri: String) -> Result<()>

Source

pub async fn get_token_user(&mut self) -> Result<User>

Source

pub async fn get_token_user_id(&mut self) -> Result<String>

Source

pub async fn get_token_user_login(&mut self) -> Result<String>

Source

pub async fn get_users_by_ids( &mut self, user_ids: Vec<String>, ) -> Result<Vec<User>>

Source

pub async fn get_users_by_logins( &mut self, user_logins: Vec<String>, ) -> Result<Vec<User>>

Source

pub async fn get_user_by_id(&mut self, user_id: String) -> Result<User>

Source

pub async fn get_user_by_login(&mut self, user_login: String) -> Result<User>

Source

pub async fn get_user(&mut self) -> Result<User>

Source

pub async fn create_custom_reward( &mut self, reward: &RewardCreate, ) -> Result<Reward>

Source

pub async fn update_custom_reward( &mut self, id: String, reward: &RewardUpdate, ) -> Result<Reward>

Source

pub async fn get_custom_rewards( &mut self, ids: Vec<String>, ) -> Result<Vec<Reward>>

Source

pub async fn get_custom_reward(&mut self, id: String) -> Result<Reward>

Source

pub async fn delete_custom_reward(&mut self, id: String) -> Result<()>

Source

pub async fn update_redemptions_status( &mut self, id: &String, redemptions: Vec<String>, status: &RedemptionStatus, ) -> Result<Vec<RedemptionStatus>>

Source

pub async fn update_redemption_status( &mut self, id: &String, redemption: &String, status: &RedemptionStatus, ) -> Result<RedemptionStatus>

Source

pub async fn create_eventsub_subscription( &mut self, eventsub: &EventSubCreate, ) -> Result<EventSub>

Source

pub async fn delete_eventsub_subscription(&mut self, id: String) -> Result<()>

Source

pub async fn add_channel_moderator(&mut self, id: String) -> Result<()>

Source

pub async fn remove_channel_moderator(&mut self, id: String) -> Result<()>

Source

pub async fn ban_user( &mut self, broadcaster_id: String, banuser: &BanUser, ) -> Result<BannedUser>

Source

pub async fn unban_user( &mut self, broadcaster_id: String, user_id: String, ) -> Result<()>

Source

pub async fn shoutout( &mut self, from_broadcaster_id: String, to_broadcaster_id: String, ) -> Result<()>

Source

pub async fn get_channel_information( &mut self, broadcaster_ids: Vec<String>, ) -> Result<Vec<ChannelInformation>>

Source

pub async fn whisper( &mut self, to_user_id: String, message: String, ) -> Result<()>

Source

pub async fn get_predictions( &mut self, id: Option<String>, first: Option<String>, after: Option<String>, ) -> Result<Vec<Prediction>>

Source

pub async fn create_prediction( &mut self, title: String, outcomes: Vec<String>, prediction_window: i64, ) -> Result<Prediction>

Source

pub async fn end_prediction( &mut self, id: String, status: String, winning_outcome_id: Option<String>, ) -> Result<Prediction>

Source

pub async fn send_chat_announcement( &mut self, broadcaster_id: String, message: String, color: Option<String>, ) -> Result<()>

Source

pub async fn start_commercial(&mut self, length: i64) -> Result<Commercial>

Source

pub async fn get_streams( &mut self, user_ids: Option<Vec<String>>, user_logins: Option<Vec<String>>, game_ids: Option<Vec<String>>, type: Option<String>, languages: Option<Vec<String>>, first: Option<i64>, before: Option<String>, after: Option<String>, ) -> Result<Vec<Stream>>

Source

pub async fn get_stream(&mut self) -> Result<Stream>

Source

pub async fn add_channel_vip(&mut self, id: String) -> Result<()>

Source

pub async fn remove_channel_vip(&mut self, id: String) -> Result<()>

Source

pub async fn get_channel_followers_total( &mut self, broadcaster_id: String, ) -> Result<i64>

Source

pub async fn get_videos( &mut self, id: VideoId, language: Option<String>, period: Option<String>, sort: Option<String>, type: Option<String>, first: Option<String>, after: Option<String>, before: Option<String>, ) -> Result<Vec<Video>>

Trait Implementations§

Source§

impl<T: Clone + TokenStorage> Clone for Client<T>

Source§

fn clone(&self) -> Client<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + TokenStorage> Debug for Client<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for Client<T>
where T: Freeze,

§

impl<T> !RefUnwindSafe for Client<T>

§

impl<T> Send for Client<T>
where T: Send,

§

impl<T> Sync for Client<T>
where T: Sync,

§

impl<T> Unpin for Client<T>
where T: Unpin,

§

impl<T> !UnwindSafe for Client<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,