1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
extern crate burgundy;
extern crate serde;
#[macro_use]
extern crate serde_derive;
pub extern crate chrono;
pub extern crate uuid;
pub mod types;
pub use burgundy::Error;
pub use burgundy::Result;
mod get;
pub use self::get::ClubhouseGet;
mod put;
pub use self::put::ClubhousePut;
mod delete;
pub use self::delete::ClubhouseDelete;
mod post;
pub use self::post::ClubhousePost;
pub struct Clubhouse {
domain: burgundy::Domain,
}
impl Clubhouse {
pub fn new(token: &str) -> Self {
let mut domain = burgundy::Domain::new(&"https://api.clubhouse.io/api/v2");
let user_agent = format!("Clubhouse (Rust, Burgundy)/{}", env!("CARGO_PKG_VERSION"));
domain.header(&"User-Agent", &user_agent.as_str());
domain.query(&"token", &token);
Self { domain }
}
pub fn get(&self) -> self::get::ClubhouseGet {
self::get::ClubhouseGet {
path: self.domain.get(),
}
}
pub fn put(&self) -> self::put::ClubhousePut {
self::put::ClubhousePut {
path: self.domain.put(),
}
}
pub fn delete(&self) -> self::delete::ClubhouseDelete {
self::delete::ClubhouseDelete {
path: self.domain.delete(),
}
}
pub fn post(&self) -> self::post::ClubhousePost {
self::post::ClubhousePost {
path: self.domain.post(),
}
}
}