Struct google_youtube3::api::YouTube
source · pub struct YouTube<S> {
pub client: Client<S, Body>,
pub auth: Box<dyn GetToken>,
/* private fields */
}
Expand description
Central instance to access all YouTube related resource activities
Examples
Instantiate a new hub
extern crate hyper;
extern crate hyper_rustls;
extern crate google_youtube3 as youtube3;
use youtube3::{Result, Error};
use std::default::Default;
use youtube3::{YouTube, oauth2, hyper, hyper_rustls, chrono, FieldMask};
// Get an ApplicationSecret instance by some means. It contains the `client_id` and
// `client_secret`, among other things.
let secret: oauth2::ApplicationSecret = Default::default();
// Instantiate the authenticator. It will choose a suitable authentication flow for you,
// unless you replace `None` with the desired Flow.
// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
// retrieve them from storage.
let auth = oauth2::InstalledFlowAuthenticator::builder(
secret,
oauth2::InstalledFlowReturnMethod::HTTPRedirect,
).build().await.unwrap();
let mut hub = YouTube::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
// You can configure optional parameters by calling the respective setters at will, and
// execute the final call using `doit()`.
// Values shown here are possibly random and not representative !
let result = hub.videos().list(&vec!["gubergren".into()])
.video_category_id("rebum.")
.region_code("est")
.page_token("ipsum")
.on_behalf_of_content_owner("ipsum")
.my_rating("est")
.max_width(-62)
.max_results(84)
.max_height(-99)
.locale("Lorem")
.add_id("eos")
.hl("labore")
.chart("sed")
.doit().await;
match result {
Err(e) => match e {
// The Error enum provides details about what exactly happened.
// You can also just use its `Debug`, `Display` or `Error` traits
Error::HttpError(_)
|Error::Io(_)
|Error::MissingAPIKey
|Error::MissingToken(_)
|Error::Cancelled
|Error::UploadSizeLimitExceeded(_, _)
|Error::Failure(_)
|Error::BadRequest(_)
|Error::FieldClash(_)
|Error::JsonDecodeError(_, _) => println!("{}", e),
},
Ok(res) => println!("Success: {:?}", res),
}
Fields§
§client: Client<S, Body>
§auth: Box<dyn GetToken>
Implementations§
source§impl<'a, S> YouTube<S>
impl<'a, S> YouTube<S>
pub fn new<A: 'static + GetToken>( client: Client<S, Body>, auth: A ) -> YouTube<S>
pub fn abuse_reports(&'a self) -> AbuseReportMethods<'a, S>
pub fn activities(&'a self) -> ActivityMethods<'a, S>
pub fn captions(&'a self) -> CaptionMethods<'a, S>
pub fn channel_sections(&'a self) -> ChannelSectionMethods<'a, S>
pub fn channels(&'a self) -> ChannelMethods<'a, S>
pub fn comment_threads(&'a self) -> CommentThreadMethods<'a, S>
pub fn comments(&'a self) -> CommentMethods<'a, S>
pub fn i18n_languages(&'a self) -> I18nLanguageMethods<'a, S>
pub fn i18n_regions(&'a self) -> I18nRegionMethods<'a, S>
pub fn live_broadcasts(&'a self) -> LiveBroadcastMethods<'a, S>
pub fn live_chat_bans(&'a self) -> LiveChatBanMethods<'a, S>
pub fn live_chat_messages(&'a self) -> LiveChatMessageMethods<'a, S>
pub fn live_chat_moderators(&'a self) -> LiveChatModeratorMethods<'a, S>
pub fn live_streams(&'a self) -> LiveStreamMethods<'a, S>
pub fn members(&'a self) -> MemberMethods<'a, S>
pub fn memberships_levels(&'a self) -> MembershipsLevelMethods<'a, S>
pub fn playlist_images(&'a self) -> PlaylistImageMethods<'a, S>
pub fn playlist_items(&'a self) -> PlaylistItemMethods<'a, S>
pub fn playlists(&'a self) -> PlaylistMethods<'a, S>
pub fn search(&'a self) -> SearchMethods<'a, S>
pub fn subscriptions(&'a self) -> SubscriptionMethods<'a, S>
pub fn super_chat_events(&'a self) -> SuperChatEventMethods<'a, S>
pub fn tests(&'a self) -> TestMethods<'a, S>
pub fn third_party_links(&'a self) -> ThirdPartyLinkMethods<'a, S>
pub fn thumbnails(&'a self) -> ThumbnailMethods<'a, S>
pub fn video_abuse_report_reasons( &'a self ) -> VideoAbuseReportReasonMethods<'a, S>
pub fn video_categories(&'a self) -> VideoCategoryMethods<'a, S>
pub fn videos(&'a self) -> VideoMethods<'a, S>
pub fn watermarks(&'a self) -> WatermarkMethods<'a, S>
pub fn youtube(&'a self) -> YoutubeMethods<'a, S>
sourcepub fn user_agent(&mut self, agent_name: String) -> String
pub fn user_agent(&mut self, agent_name: String) -> String
Set the user-agent header field to use in all requests to the server.
It defaults to google-api-rust-client/5.0.3
.
Returns the previously set user-agent.
Trait Implementations§
Auto Trait Implementations§
impl<S> !RefUnwindSafe for YouTube<S>
impl<S> Send for YouTube<S>where
S: Send,
impl<S> Sync for YouTube<S>where
S: Sync,
impl<S> Unpin for YouTube<S>where
S: Unpin,
impl<S> !UnwindSafe for YouTube<S>
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