diff --git a/Cargo.toml b/Cargo.toml index 852ad4a..785c542 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "google_youtube" -version = "0.1.6" +version = "0.2.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/lib.rs b/src/lib.rs index cd7e322..d0a2e2d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,12 +12,12 @@ use google_youtube3::{ api::PlaylistItemSnippet, api::PlaylistListResponse, api::PlaylistSnippet, + api::PlaylistStatus, api::ResourceId, api::Video, api::VideoSnippet, api::VideoStatus, - hyper::client::HttpConnector, - hyper::{Body, Response}, + hyper::{client::HttpConnector, Body, Response}, hyper_rustls::HttpsConnector, }; #[cfg(feature = "tracing")] @@ -136,12 +136,16 @@ impl YoutubeClient { } #[cfg_attr(feature = "tracing", instrument)] - pub async fn find_playlist_or_create_by_name(&self, name: &str) -> Result { + pub async fn find_playlist_or_create_by_name( + &self, + name: &str, + privacy: PrivacyStatus, + ) -> Result { let playlist = self.find_playlist_by_name(name).await?; if let Some(playlist) = playlist { return Ok(playlist); } - let playlist = self.create_playlist(name).await?; + let playlist = self.create_playlist(name, privacy).await?; Ok(playlist) } @@ -290,12 +294,15 @@ impl YoutubeClient { // } } #[cfg_attr(feature = "tracing", instrument)] - async fn create_playlist(&self, name: &str) -> Result { + async fn create_playlist(&self, name: &str, privacy: PrivacyStatus) -> Result { let playlist = Playlist { snippet: Some(PlaylistSnippet { title: Some(name.to_string()), ..Default::default() }), + status: Some(PlaylistStatus { + privacy_status: Some(privacy.to_string()), + }), ..Default::default() };