Struct tw_api::types::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 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 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_id(&mut self) -> Result<String>

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 get_users_by_ids( &mut self, user_ids: Vec<i64> ) -> 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: i64) -> 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: &RewardCreate ) -> 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>>

Trait Implementations§

source§

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

source§

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

Returns a copy 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> !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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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<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