harvest_api/request/
retrieve_company.rs1use serde_json::json;
2use crate::model::*;
3use crate::HarvestClient;
4pub struct RetrieveCompanyRequest<'a> {
8 pub(crate) client: &'a HarvestClient,
9}
10impl<'a> RetrieveCompanyRequest<'a> {
11 pub async fn send(self) -> anyhow::Result<Company> {
12 let mut r = self.client.client.get("/company");
13 r = self.client.authenticate(r);
14 let res = r.send().await.unwrap().error_for_status();
15 match res {
16 Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
17 Err(res) => {
18 let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
19 Err(anyhow::anyhow!("{:?}", text))
20 }
21 }
22 }
23}