benchling/request/
get_workflow_task_group.rs

1use serde_json::json;
2use crate::model::*;
3use crate::BenchlingClient;
4/**Create this with the associated client method.
5
6That method takes required values as arguments. Set optional values using builder methods on this struct.*/
7pub struct GetWorkflowTaskGroupRequest<'a> {
8    pub(crate) client: &'a BenchlingClient,
9    pub workflow_task_group_id: String,
10}
11impl<'a> GetWorkflowTaskGroupRequest<'a> {
12    pub async fn send(self) -> anyhow::Result<WorkflowTaskGroup> {
13        let mut r = self
14            .client
15            .client
16            .get(
17                &format!(
18                    "/workflow-task-groups/{workflow_task_group_id}",
19                    workflow_task_group_id = self.workflow_task_group_id
20                ),
21            );
22        r = self.client.authenticate(r);
23        let res = r.send().await.unwrap().error_for_status();
24        match res {
25            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
26            Err(res) => {
27                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
28                Err(anyhow::anyhow!("{:?}", text))
29            }
30        }
31    }
32}