use crate::model::*;
use crate::JyveClient;
use serde_json::json;
#[derive(Clone)]
pub struct StoreChainsListRequest<'a> {
pub(crate) http_client: &'a JyveClient,
pub class_of_trade: Option<String>,
pub created_at: Option<String>,
pub deleted: Option<String>,
pub name: Option<String>,
pub page: Option<i64>,
pub page_size: Option<i64>,
pub parent_company: Option<String>,
pub store_locations_jobs_brand_public_id: Option<String>,
pub updated_at: Option<String>,
}
impl<'a> StoreChainsListRequest<'a> {
pub async fn send(self) -> ::httpclient::InMemoryResult<Vec<StoreChain>> {
let mut r = self.http_client.client.get("/store_chains/");
if let Some(ref unwrapped) = self.class_of_trade {
r = r.query("class_of_trade", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.created_at {
r = r.query("created_at", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.deleted {
r = r.query("deleted", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.name {
r = r.query("name", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.page {
r = r.query("page", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.page_size {
r = r.query("page_size", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.parent_company {
r = r.query("parent_company", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.store_locations_jobs_brand_public_id {
r = r.query("store_locations__jobs__brand__public_id", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.updated_at {
r = r.query("updated_at", &unwrapped.to_string());
}
r = self.http_client.authenticate(r);
let res = r.send_awaiting_body().await?;
res.json()
}
pub fn class_of_trade(mut self, class_of_trade: &str) -> Self {
self.class_of_trade = Some(class_of_trade.to_owned());
self
}
pub fn created_at(mut self, created_at: &str) -> Self {
self.created_at = Some(created_at.to_owned());
self
}
pub fn deleted(mut self, deleted: &str) -> Self {
self.deleted = Some(deleted.to_owned());
self
}
pub fn name(mut self, name: &str) -> Self {
self.name = Some(name.to_owned());
self
}
pub fn page(mut self, page: i64) -> Self {
self.page = Some(page);
self
}
pub fn page_size(mut self, page_size: i64) -> Self {
self.page_size = Some(page_size);
self
}
pub fn parent_company(mut self, parent_company: &str) -> Self {
self.parent_company = Some(parent_company.to_owned());
self
}
pub fn store_locations_jobs_brand_public_id(mut self, store_locations_jobs_brand_public_id: &str) -> Self {
self.store_locations_jobs_brand_public_id = Some(store_locations_jobs_brand_public_id.to_owned());
self
}
pub fn updated_at(mut self, updated_at: &str) -> Self {
self.updated_at = Some(updated_at.to_owned());
self
}
}
impl<'a> ::std::future::IntoFuture for StoreChainsListRequest<'a> {
type Output = httpclient::InMemoryResult<Vec<StoreChain>>;
type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
fn into_future(self) -> Self::IntoFuture {
Box::pin(self.send())
}
}