feat: construct grpc request and response
Now it follows the youtube livechat service thing or whatever
This commit is contained in:
20
src/main.rs
20
src/main.rs
@@ -5,8 +5,24 @@ mod client;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
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(),
|
||||
|
||||
Reference in New Issue
Block a user