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
use crate::core::engine::Engine; use crate::http::path::Path; use serde_json::{Value, Result}; pub struct Profile <'a> { pub engine: &'a mut Engine, pub username: String, } impl <'a> Profile <'a> { pub fn new(engine: &'a mut Engine) -> Self { Profile { engine: engine, username: "".to_owned(), } } pub fn username(&mut self, username: String) -> &mut Self { self.username = username; self } pub fn get(&mut self) -> Result<Value> { let path = Path::new().slash(&"users".to_owned()).slash(&self.username).ok(); self.engine.get(&path) } }