File tree 3 files changed +8
-11
lines changed 3 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -22,9 +22,9 @@ use twitch_api::twitch_oauth2::{AccessToken, UserToken};
22
22
23
23
#[tokio:: main]
24
24
async fn main () -> Result <(), Box <dyn std :: error :: Error + Send + Sync + 'static >> {
25
-
25
+ // Create the HelixClient, which is used to make requests to the Twitch API
26
26
let client : HelixClient <reqwest :: Client > = HelixClient :: default ();
27
-
27
+ // Create a UserToken, which is used to authenticate requests
28
28
let token = UserToken :: from_token (& client , AccessToken :: from (" mytoken" )). await ? ;
29
29
30
30
println! (
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ pub async fn run(opts: &Opts) -> eyre::Result<()> {
67
67
. wrap_err_with ( || "when creating client" ) ?,
68
68
) ;
69
69
70
- // Get the access token
70
+ // Get the app access token
71
71
let token = twitch_oauth2:: AppAccessToken :: get_app_access_token (
72
72
& client,
73
73
opts. client_id . clone ( ) ,
Original file line number Diff line number Diff line change 19
19
//! ```rust,no_run
20
20
//! use twitch_api::helix::HelixClient;
21
21
//! use twitch_api::twitch_oauth2::{AccessToken, UserToken};
22
- //! pub type BoxedStdError = Box<dyn std::error::Error + Send + Sync + 'static>;
23
22
//!
24
23
//! #[tokio::main]
25
- //! async fn main() -> Result<(), BoxedStdError> {
24
+ //! async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
25
+ //! // Create the HelixClient, which is used to make requests to the Twitch API
26
26
//! let client: HelixClient<reqwest::Client> = HelixClient::default();
27
- //!
28
- //! let token =
29
- //! UserToken::from_token(&client, AccessToken::from("mytoken"))
30
- //! .await?;
27
+ //! // Create a UserToken, which is used to authenticate requests.
28
+ //! let token = UserToken::from_token(&client, AccessToken::from("mytoken")).await?;
31
29
//!
32
30
//! println!(
33
31
//! "Channel: {:?}",
45
43
//! tokens::errors::AppAccessTokenError, AppAccessToken, TwitchToken,
46
44
//! };
47
45
//! use twitch_api::{helix::channels::GetChannelInformationRequest, TwitchClient};
48
- //! pub type BoxedStdError = Box<dyn std::error::Error + Send + Sync + 'static>;
49
46
//!
50
47
//! #[tokio::main]
51
- //! async fn main() -> Result<(), BoxedStdError > {
48
+ //! async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static> > {
52
49
//! let client: TwitchClient<reqwest::Client> = TwitchClient::default();
53
50
//! let token = AppAccessToken::get_app_access_token(
54
51
//! &client,
You can’t perform that action at this time.
0 commit comments