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
31
32
33
34
35
36
37
38
39
40
use std::sync::Arc;
use jsonrpsee_types::{traits::Client, v2::params::ParamsSer};
use jsonrpsee_ws_client::WsClient;
use crate::{credentials::Credentials, RpcError};
pub struct SessionProcedures {
pub(crate) inner: Arc<WsClient>,
}
impl SessionProcedures {
pub async fn sign_in(&self, credentials: impl Into<Credentials>) -> Result<(), RpcError> {
log::debug!("Signing in...");
#[derive(serde::Serialize)]
pub struct Credentials {
email: String,
password: String,
}
let _: SigninResponse = self
.inner
.request(
"session.signIn",
Some(ParamsSer::Map(credentials.into().into())),
)
.await?;
log::debug!("Signed in");
Ok(())
}
}
#[derive(serde::Deserialize)]
struct SigninResponse {}