From f90b670cb5a948581887e1454d921f6bfd4e959a Mon Sep 17 00:00:00 2001 From: Aly Sewelam Date: Mon, 13 Apr 2026 08:02:15 +0200 Subject: [PATCH] feat: construct grpc request and response Now it follows the youtube livechat service thing or whatever --- src/main.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) 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(),