use crate::model::*;
use crate::JyveClient;
use serde_json::json;
#[derive(Clone)]
pub struct TasksListRequest<'a> {
pub(crate) http_client: &'a JyveClient,
pub brand: Option<f64>,
pub client: Option<String>,
pub client_slug: Option<String>,
pub completed_after: Option<String>,
pub completed_before: Option<String>,
pub id: Option<f64>,
pub ids: Option<String>,
pub job: Option<String>,
pub job_completed_after: Option<String>,
pub job_completed_after_gt: Option<String>,
pub job_completed_after_gte: Option<String>,
pub job_completed_before: Option<String>,
pub job_completed_before_lt: Option<String>,
pub job_completed_before_lte: Option<String>,
pub jobs: Option<String>,
pub page: Option<i64>,
pub page_size: Option<i64>,
pub status: Option<String>,
pub store_chain: Option<f64>,
pub store_chains: Option<String>,
pub store_location: Option<f64>,
pub store_locations: Option<String>,
pub type_: Option<String>,
pub types: Option<String>,
pub user: Option<f64>,
}
impl<'a> TasksListRequest<'a> {
pub async fn send(self) -> ::httpclient::InMemoryResult<Vec<Task>> {
let mut r = self.http_client.client.get("/tasks/");
if let Some(ref unwrapped) = self.brand {
r = r.query("brand", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.client {
r = r.query("client", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.client_slug {
r = r.query("client_slug", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.completed_after {
r = r.query("completed_after", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.completed_before {
r = r.query("completed_before", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.id {
r = r.query("id", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.ids {
r = r.query("ids", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.job {
r = r.query("job", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.job_completed_after {
r = r.query("job_completed_after", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.job_completed_after_gt {
r = r.query("job_completed_after__gt", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.job_completed_after_gte {
r = r.query("job_completed_after__gte", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.job_completed_before {
r = r.query("job_completed_before", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.job_completed_before_lt {
r = r.query("job_completed_before__lt", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.job_completed_before_lte {
r = r.query("job_completed_before__lte", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.jobs {
r = r.query("jobs", &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.status {
r = r.query("status", &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());
}
if let Some(ref unwrapped) = self.store_location {
r = r.query("store_location", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.store_locations {
r = r.query("store_locations", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.type_ {
r = r.query("type", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.types {
r = r.query("types", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.user {
r = r.query("user", &unwrapped.to_string());
}
r = self.http_client.authenticate(r);
let res = r.send_awaiting_body().await?;
res.json()
}
pub fn brand(mut self, brand: f64) -> Self {
self.brand = Some(brand);
self
}
pub fn client(mut self, client: &str) -> Self {
self.client = Some(client.to_owned());
self
}
pub fn client_slug(mut self, client_slug: &str) -> Self {
self.client_slug = Some(client_slug.to_owned());
self
}
pub fn completed_after(mut self, completed_after: &str) -> Self {
self.completed_after = Some(completed_after.to_owned());
self
}
pub fn completed_before(mut self, completed_before: &str) -> Self {
self.completed_before = Some(completed_before.to_owned());
self
}
pub fn id(mut self, id: f64) -> Self {
self.id = Some(id);
self
}
pub fn ids(mut self, ids: &str) -> Self {
self.ids = Some(ids.to_owned());
self
}
pub fn job(mut self, job: &str) -> Self {
self.job = Some(job.to_owned());
self
}
pub fn job_completed_after(mut self, job_completed_after: &str) -> Self {
self.job_completed_after = Some(job_completed_after.to_owned());
self
}
pub fn job_completed_after_gt(mut self, job_completed_after_gt: &str) -> Self {
self.job_completed_after_gt = Some(job_completed_after_gt.to_owned());
self
}
pub fn job_completed_after_gte(mut self, job_completed_after_gte: &str) -> Self {
self.job_completed_after_gte = Some(job_completed_after_gte.to_owned());
self
}
pub fn job_completed_before(mut self, job_completed_before: &str) -> Self {
self.job_completed_before = Some(job_completed_before.to_owned());
self
}
pub fn job_completed_before_lt(mut self, job_completed_before_lt: &str) -> Self {
self.job_completed_before_lt = Some(job_completed_before_lt.to_owned());
self
}
pub fn job_completed_before_lte(mut self, job_completed_before_lte: &str) -> Self {
self.job_completed_before_lte = Some(job_completed_before_lte.to_owned());
self
}
pub fn jobs(mut self, jobs: &str) -> Self {
self.jobs = Some(jobs.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 status(mut self, status: &str) -> Self {
self.status = Some(status.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
}
pub fn store_location(mut self, store_location: f64) -> Self {
self.store_location = Some(store_location);
self
}
pub fn store_locations(mut self, store_locations: &str) -> Self {
self.store_locations = Some(store_locations.to_owned());
self
}
pub fn type_(mut self, type_: &str) -> Self {
self.type_ = Some(type_.to_owned());
self
}
pub fn types(mut self, types: &str) -> Self {
self.types = Some(types.to_owned());
self
}
pub fn user(mut self, user: f64) -> Self {
self.user = Some(user);
self
}
}
impl<'a> ::std::future::IntoFuture for TasksListRequest<'a> {
type Output = httpclient::InMemoryResult<Vec<Task>>;
type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
fn into_future(self) -> Self::IntoFuture {
Box::pin(self.send())
}
}