use serde_json::json;
use crate::model::*;
use crate::BenchlingClient;
pub struct ListPlateSchemasRequest<'a> {
pub(crate) client: &'a BenchlingClient,
pub next_token: Option<String>,
pub page_size: Option<i64>,
}
impl<'a> ListPlateSchemasRequest<'a> {
pub async fn send(self) -> anyhow::Result<PlateSchemasPaginatedList> {
let mut r = self.client.client.get("/plate-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());
}
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
}
}