benchling/request/
bulk_get_dna_sequences.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 BulkGetDnaSequencesRequest<'a> {
8    pub(crate) client: &'a BenchlingClient,
9    pub dna_sequence_ids: String,
10}
11impl<'a> BulkGetDnaSequencesRequest<'a> {
12    pub async fn send(self) -> anyhow::Result<DnaSequencesBulkGet> {
13        let mut r = self.client.client.get("/dna-sequences:bulk-get");
14        r = r.push_query("dnaSequenceIds", &self.dna_sequence_ids.to_string());
15        r = self.client.authenticate(r);
16        let res = r.send().await.unwrap().error_for_status();
17        match res {
18            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
19            Err(res) => {
20                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
21                Err(anyhow::anyhow!("{:?}", text))
22            }
23        }
24    }
25}