summaryrefslogtreecommitdiffhomepage
path: root/mullvad-daemon/src/master.rs
blob: 37bfbe65e5af96d78c2bfd188fe8ac0bfd079916 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use chrono::DateTime;
use chrono::offset::Utc;
use jsonrpc_client_http::{Error as HttpError, HttpHandle, HttpTransport};

use mullvad_types::account::AccountToken;

static MASTER_API_URI: &str = "https://api.mullvad.net/rpc/";

pub fn create_account_proxy() -> Result<AccountsProxy<HttpHandle>, HttpError> {
    let transport = HttpTransport::new()?.handle(MASTER_API_URI)?;
    Ok(AccountsProxy::new(transport))
}

jsonrpc_client!(pub struct AccountsProxy {
    pub fn get_expiry(&mut self, account_token: AccountToken) -> RpcRequest<DateTime<Utc>>;
});