41 lines
753 B
Rust
41 lines
753 B
Rust
use skytable::{
|
|
query::SQParam,
|
|
response::{FromResponse, Response},
|
|
ClientResult,
|
|
};
|
|
|
|
|
|
pub struct Sites {
|
|
pub uuid: String,
|
|
pub uid: String,
|
|
pub domain: String,
|
|
pub pkey: Vec<u8>,
|
|
pub skey: Vec<u8>,
|
|
}
|
|
|
|
impl Sites {
|
|
pub fn new(uuid: String, uid: String, domain: String, pkey: Vec<u8>, skey: Vec<u8>) -> Self {
|
|
Self {
|
|
uuid,
|
|
uid,
|
|
domain,
|
|
pkey,
|
|
skey,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl SQParam for Sites {
|
|
fn append_param(&self, q: &mut Vec<u8>) -> usize {
|
|
self.uuid.append_param(q)
|
|
+ self.domain.append_param(q)
|
|
}
|
|
}
|
|
|
|
impl FromResponse for Sites {
|
|
fn from_response(resp: Response) -> ClientResult<Self> {
|
|
let (uuid, uid, domain, pkey, skey) = FromResponse::from_response(resp)?;
|
|
Ok(Self::new(uuid, uid, domain, pkey, skey))
|
|
}
|
|
}
|