pub struct YoutubeApi { /* private fields */ }
Implementations§
Source§impl YoutubeApi
impl YoutubeApi
pub fn new_with_oauth<S: Into<String>>( api_key: S, client_id: String, client_secret: String, redirect_uri: Option<&str>, ) -> Result<Self, Error>
Sourcepub async fn login<H>(&self, handler: H) -> Result<(), Error>
pub async fn login<H>(&self, handler: H) -> Result<(), Error>
Perform an OAuth Login
Available handlers:
§Example
use youtube::{YoutubeApi, auth::stdio_login};
#[tokio::main]
async fn main() {
let api = YoutubeApi::new_with_oauth("", String::new(), String::new(), None).unwrap();
api.login(stdio_login).await.unwrap();
}
pub fn get_oauth_url(&self) -> Result<(String, String), Error>
pub async fn request_token( &mut self, code: String, verifier: String, ) -> Result<(), Error>
pub fn has_token(&self) -> bool
Sourcepub async fn store_token(&self) -> Result<(), Error>
pub async fn store_token(&self) -> Result<(), Error>
Stores the auth and refresh token in a .google-auth.json
file for login without user input.
Sourcepub async fn load_token(&self) -> Result<(), Error>
pub async fn load_token(&self) -> Result<(), Error>
Stores the auth and refresh token from a .google-auth.json
file for login without user input.
Source§impl YoutubeApi
impl YoutubeApi
pub async fn get_video_info(id: &str) -> Result<VideoMetadata, Error>
pub fn new<S: Into<String>>(api_key: S) -> Self
pub async fn search( &self, search_request: SearchRequestBuilder, ) -> Result<SearchResponse, Error>
pub async fn list_playlists( &self, request: ListPlaylistsRequestBuilder, ) -> Result<ListPlaylistsResponse, Error>
pub async fn list_playlist_items( &self, request: ListPlaylistItemsRequestBuilder, ) -> Result<ListPlaylistItemsResponse, Error>
Trait Implementations§
Source§impl Clone for YoutubeApi
impl Clone for YoutubeApi
Source§fn clone(&self) -> YoutubeApi
fn clone(&self) -> YoutubeApi
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for YoutubeApi
impl !RefUnwindSafe for YoutubeApi
impl Send for YoutubeApi
impl Sync for YoutubeApi
impl Unpin for YoutubeApi
impl !UnwindSafe for YoutubeApi
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more