use crate::model::*;
use crate::JyveClient;
use serde_json::json;
#[derive(Clone)]
pub struct StoresListRequest<'a> {
pub(crate) http_client: &'a JyveClient,
pub address: Option<String>,
pub brand_territory_brand_public_id: Option<String>,
pub chain_name: Option<String>,
pub city: Option<String>,
pub county: Option<String>,
pub ids: Option<String>,
pub job_completed_range: Option<String>,
pub job_ids: Option<String>,
pub jyver_density_gte: Option<f64>,
pub ordering: Option<String>,
pub page: Option<i64>,
pub page_size: Option<i64>,
pub postal_code: Option<String>,
pub primary_self_identity: Option<String>,
pub q: Option<String>,
pub state: Option<String>,
pub store_chain: Option<f64>,
pub store_chains: Option<String>,
}
impl<'a> StoresListRequest<'a> {
pub async fn send(self) -> ::httpclient::InMemoryResult<Vec<Store>> {
let mut r = self.http_client.client.get("/stores/");
if let Some(ref unwrapped) = self.address {
r = r.query("address", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.brand_territory_brand_public_id {
r = r.query("brand_territory_brand_public_id", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.chain_name {
r = r.query("chain_name", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.city {
r = r.query("city", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.county {
r = r.query("county", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.ids {
r = r.query("ids", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.job_completed_range {
r = r.query("job_completed_range", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.job_ids {
r = r.query("job_ids", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.jyver_density_gte {
r = r.query("jyver_density__gte", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.ordering {
r = r.query("ordering", &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.postal_code {
r = r.query("postal_code", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.primary_self_identity {
r = r.query("primary_self_identity", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.q {
r = r.query("q", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.state {
r = r.query("state", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.store_chain {
r = r.query("store_chain", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.store_chains {
r = r.query("store_chains", &unwrapped.to_string());
}
r = self.http_client.authenticate(r);
let res = r.send_awaiting_body().await?;
res.json()
}
pub fn address(mut self, address: &str) -> Self {
self.address = Some(address.to_owned());
self
}
pub fn brand_territory_brand_public_id(mut self, brand_territory_brand_public_id: &str) -> Self {
self.brand_territory_brand_public_id = Some(brand_territory_brand_public_id.to_owned());
self
}
pub fn chain_name(mut self, chain_name: &str) -> Self {
self.chain_name = Some(chain_name.to_owned());
self
}
pub fn city(mut self, city: &str) -> Self {
self.city = Some(city.to_owned());
self
}
pub fn county(mut self, county: &str) -> Self {
self.county = Some(county.to_owned());
self
}
pub fn ids(mut self, ids: &str) -> Self {
self.ids = Some(ids.to_owned());
self
}
pub fn job_completed_range(mut self, job_completed_range: &str) -> Self {
self.job_completed_range = Some(job_completed_range.to_owned());
self
}
pub fn job_ids(mut self, job_ids: &str) -> Self {
self.job_ids = Some(job_ids.to_owned());
self
}
pub fn jyver_density_gte(mut self, jyver_density_gte: f64) -> Self {
self.jyver_density_gte = Some(jyver_density_gte);
self
}
pub fn ordering(mut self, ordering: &str) -> Self {
self.ordering = Some(ordering.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 postal_code(mut self, postal_code: &str) -> Self {
self.postal_code = Some(postal_code.to_owned());
self
}
pub fn primary_self_identity(mut self, primary_self_identity: &str) -> Self {
self.primary_self_identity = Some(primary_self_identity.to_owned());
self
}
pub fn q(mut self, q: &str) -> Self {
self.q = Some(q.to_owned());
self
}
pub fn state(mut self, state: &str) -> Self {
self.state = Some(state.to_owned());
self
}
pub fn store_chain(mut self, store_chain: f64) -> Self {
self.store_chain = Some(store_chain);
self
}
pub fn store_chains(mut self, store_chains: &str) -> Self {
self.store_chains = Some(store_chains.to_owned());
self
}
}
impl<'a> ::std::future::IntoFuture for StoresListRequest<'a> {
type Output = httpclient::InMemoryResult<Vec<Store>>;
type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
fn into_future(self) -> Self::IntoFuture {
Box::pin(self.send())
}
}