benchling/request/
list_automation_input_generators.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 ListAutomationInputGeneratorsRequest<'a> {
8    pub(crate) client: &'a BenchlingClient,
9    pub assay_run_id: String,
10    pub next_token: Option<String>,
11    pub modified_at: Option<String>,
12}
13impl<'a> ListAutomationInputGeneratorsRequest<'a> {
14    pub async fn send(self) -> anyhow::Result<AutomationFileInputsPaginatedList> {
15        let mut r = self
16            .client
17            .client
18            .get(
19                &format!(
20                    "/assay-runs/{assay_run_id}/automation-input-generators",
21                    assay_run_id = self.assay_run_id
22                ),
23            );
24        if let Some(ref unwrapped) = self.next_token {
25            r = r.push_query("nextToken", &unwrapped.to_string());
26        }
27        if let Some(ref unwrapped) = self.modified_at {
28            r = r.push_query("modifiedAt", &unwrapped.to_string());
29        }
30        r = self.client.authenticate(r);
31        let res = r.send().await.unwrap().error_for_status();
32        match res {
33            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
34            Err(res) => {
35                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
36                Err(anyhow::anyhow!("{:?}", text))
37            }
38        }
39    }
40    pub fn next_token(mut self, next_token: &str) -> Self {
41        self.next_token = Some(next_token.to_owned());
42        self
43    }
44    pub fn modified_at(mut self, modified_at: &str) -> Self {
45        self.modified_at = Some(modified_at.to_owned());
46        self
47    }
48}