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