WIP: start on live_kit_server
This commit is contained in:
parent
caeae38e3a
commit
5d433b1666
10 changed files with 144 additions and 75 deletions
36
crates/live_kit_server/src/api.rs
Normal file
36
crates/live_kit_server/src/api.rs
Normal file
|
@ -0,0 +1,36 @@
|
|||
use crate::token;
|
||||
use hyper::{client::HttpConnector, Request, Uri};
|
||||
|
||||
pub struct Client {
|
||||
http: hyper::Client<HttpConnector>,
|
||||
uri: Uri,
|
||||
key: String,
|
||||
secret: String,
|
||||
}
|
||||
|
||||
impl Client {
|
||||
pub fn new(uri: Uri, key: String, secret: String) -> Self {
|
||||
assert!(uri.scheme().is_some(), "base uri must have a scheme");
|
||||
assert!(uri.authority().is_some(), "base uri must have an authority");
|
||||
Self {
|
||||
http: hyper::Client::new(),
|
||||
uri: uri,
|
||||
key,
|
||||
secret,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn create_room(&self) {
|
||||
// let mut uri = url.clone();
|
||||
// uri.set_path_and_query()
|
||||
|
||||
let uri = Uri::builder()
|
||||
.scheme(self.uri.scheme().unwrap().clone())
|
||||
.authority(self.uri.authority().unwrap().clone())
|
||||
.path_and_query("twirp/livekit.RoomService/CreateRoom")
|
||||
.build();
|
||||
|
||||
// token::create(api_key, secret_key, room_name, participant_name)
|
||||
self.http.request(req)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue