use serde_json::json;
use crate::model::*;
use crate::BenchlingClient;
pub struct ListBatchSchemasRequest<'a> {
pub(crate) client: &'a BenchlingClient,
pub next_token: Option<String>,
pub page_size: Option<i64>,
pub modified_at: Option<String>,
}
impl<'a> ListBatchSchemasRequest<'a> {
pub async fn send(self) -> anyhow::Result<BatchSchemasPaginatedList> {
let mut r = self.client.client.get("/batch-schemas");
if let Some(ref unwrapped) = self.next_token {
r = r.push_query("nextToken", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.page_size {
r = r.push_query("pageSize", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.modified_at {
r = r.push_query("modifiedAt", &unwrapped.to_string());
}
r = self.client.authenticate(r);
let res = r.send().await.unwrap().error_for_status();
match res {
Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
Err(res) => {
let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
Err(anyhow::anyhow!("{:?}", text))
}
}
}
pub fn next_token(mut self, next_token: &str) -> Self {
self.next_token = Some(next_token.to_owned());
self
}
pub fn page_size(mut self, page_size: i64) -> Self {
self.page_size = Some(page_size);
self
}
pub fn modified_at(mut self, modified_at: &str) -> Self {
self.modified_at = Some(modified_at.to_owned());
self
}
}