lisk_api_rust_client/api/
accounts.rs

1use http::client::Client;
2use std::borrow::Borrow;
3
4use api::models::Account;
5use api::Result;
6
7pub struct Accounts {
8    client: Client,
9}
10
11impl Accounts {
12    pub fn new(client: Client) -> Accounts {
13        Accounts { client }
14    }
15
16    pub fn all(&self) -> Result<Vec<Account>> {
17        self.all_params(Vec::<(String, String)>::new())
18    }
19
20    pub fn all_params<I, K, V>(&self, parameters: I) -> Result<Vec<Account>>
21    where
22        I: IntoIterator,
23        I::Item: Borrow<(K, V)>,
24        K: AsRef<str>,
25        V: AsRef<str>,
26    {
27        self.client.get_with_params("accounts", parameters)
28    }
29
30    pub fn multisignature_groups(&self, address: &str) -> Result<Vec<Account>> {
31        let endpoint = format!("accounts/{}/multisignature_groups", address);
32        self.client.get(&endpoint)
33    }
34
35    pub fn multisignature_memberships(&self, address: &str) -> Result<Vec<Account>> {
36        let endpoint = format!("accounts/{}/multisignature_memberships", address);
37        self.client.get(&endpoint)
38    }
39}