use crate::model::*;
use crate::JyveClient;
use serde_json::json;
#[derive(Clone)]
pub struct StoreGroupsListRequest<'a> {
pub(crate) http_client: &'a JyveClient,
pub ancestor: Option<String>,
pub id: Option<f64>,
pub ids: Option<String>,
pub is_archived: Option<String>,
pub name: Option<String>,
pub ordering: Option<String>,
pub page: Option<i64>,
pub page_size: Option<i64>,
pub parent: Option<f64>,
pub primary_manager: Option<f64>,
pub slug: Option<String>,
pub source: Option<String>,
pub type_: Option<String>,
}
impl<'a> StoreGroupsListRequest<'a> {
pub async fn send(self) -> ::httpclient::InMemoryResult<Vec<StoreGroupWithChildren>> {
let mut r = self.http_client.client.get("/store_groups/");
if let Some(ref unwrapped) = self.ancestor {
r = r.query("ancestor", &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.is_archived {
r = r.query("is_archived", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.name {
r = r.query("name", &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.parent {
r = r.query("parent", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.primary_manager {
r = r.query("primary_manager", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.slug {
r = r.query("slug", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.source {
r = r.query("source", &unwrapped.to_string());
}
if let Some(ref unwrapped) = self.type_ {
r = r.query("type", &unwrapped.to_string());
}
r = self.http_client.authenticate(r);
let res = r.send_awaiting_body().await?;
res.json()
}
pub fn ancestor(mut self, ancestor: &str) -> Self {
self.ancestor = Some(ancestor.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 is_archived(mut self, is_archived: &str) -> Self {
self.is_archived = Some(is_archived.to_owned());
self
}
pub fn name(mut self, name: &str) -> Self {
self.name = Some(name.to_owned());
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 parent(mut self, parent: f64) -> Self {
self.parent = Some(parent);
self
}
pub fn primary_manager(mut self, primary_manager: f64) -> Self {
self.primary_manager = Some(primary_manager);
self
}
pub fn slug(mut self, slug: &str) -> Self {
self.slug = Some(slug.to_owned());
self
}
pub fn source(mut self, source: &str) -> Self {
self.source = Some(source.to_owned());
self
}
pub fn type_(mut self, type_: &str) -> Self {
self.type_ = Some(type_.to_owned());
self
}
}
impl<'a> ::std::future::IntoFuture for StoreGroupsListRequest<'a> {
type Output = httpclient::InMemoryResult<Vec<StoreGroupWithChildren>>;
type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
fn into_future(self) -> Self::IntoFuture {
Box::pin(self.send())
}
}