diff --git a/src/main.rs b/src/main.rs index d5d51be..3acc11d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,8 +5,24 @@ mod client; #[tokio::main] async fn main() -> Result<(), Box> { - let channel = Channel::from_static("dns:///youtube.googleapis.com:443"); - let mut client = V3DataLiveChatMessageServiceClient::connect("http://[::1]:50051").await?; + let channel = Channel::from_static("dns:///youtube.googleapis.com:443").connect().await?; + let token: MetadataValue<_> = "Bearer my-secret-token".parse()?; + let mut client = V3DataLiveChatMessageServiceClient::with_interceptor( + channel, + move |mut req: Request<()>| { + req.metadata_mut().insert("authorization", token.clone()); + Ok(req) + }, + ); + + let request = tonic::Request::new(LiveChatMessageListRequest { + part: vec!["snippet".to_string()], + live_chat_id: Some("A0VHDvkheIg".to_string()), // TODO Fetch Latest Stream ID + max_results: Some(20), + page_token: None, + hl: None, + profile_image_size: None, + }); // let request = tonic::Request::new(LiveChatMessageListRequest { // name: "Tonic".into(),