blend_api/
request_model.rs1use serde_json::json;
2use crate::model;
3use crate::model::*;
4use crate::BlendClient;
5pub struct GetCurrentUserRequest<'a> {
6 pub(crate) client: &'a BlendClient,
7}
8impl<'a> GetCurrentUserRequest<'a> {
9 pub async fn send(self) -> anyhow::Result<CurrentUser> {
10 let mut r = self.client.client.get("/authentication-status");
11 r = self.client.authenticate(r);
12 let res = r.send().await.unwrap().error_for_status();
13 match res {
14 Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
15 Err(res) => {
16 let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
17 Err(anyhow::anyhow!("{:?}", text))
18 }
19 }
20 }
21}