aboutsummaryrefslogtreecommitdiff
path: root/src/call/account.rs
blob: f35ab00f6e3e088a3afdc48f630d02348f52336a (plain) (blame)
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
use std::collections::BTreeMap;

// Contains login information. Used to create an API session.
pub(crate) struct Login<'a> {
    pub(crate) user: &'a str,
    pub(crate) pass: &'a str,
    pub(crate) case_insensitive: bool,
}

impl From<Login<'_>> for xmlrpc::Value {
    fn from(login: Login<'_>) -> Self {
        let mut map = BTreeMap::new();

        map.insert("user".into(), login.user.into());
        map.insert("pass".into(), login.pass.into());
        map.insert("case-insensitive".into(), login.case_insensitive.into());

        xmlrpc::Value::Struct(map)
    }
}

// Contains no information. This just signals to the server
// that it should end the session.
pub(crate) struct Logout;

impl From<Logout> for xmlrpc::Value {
    fn from(_logout: Logout) -> Self {
        xmlrpc::Value::Nil
    }
}