#[allow(unused_imports)]
use crate::{error::Result, models::*, Configuration};
#[derive(Default)]
pub struct FeaturesListFeaturesOptions {
pub statuses: Option<Vec<FeatureStatus>>,
pub product_id: Option<ProductId>,
pub search: Option<String>,
pub page: Option<i32>,
pub per_page: Option<i32>,
}
pub struct Features<'a> {
cfg: &'a Configuration,
}
impl<'a> Features<'a> {
pub(super) fn new(cfg: &'a Configuration) -> Self {
Self { cfg }
}
pub async fn list_features(
&self,
options: Option<FeaturesListFeaturesOptions>,
) -> Result<crate::models::FeatureListResponse> {
let FeaturesListFeaturesOptions {
statuses,
product_id,
search,
page,
per_page,
} = options.unwrap_or_default();
crate::request::Request::new(http1::Method::GET, "/api/v1/features")
.with_optional_exploded_query_param("statuses", statuses)
.with_optional_query_param("product_id", product_id)
.with_optional_query_param("search", search)
.with_optional_query_param("page", page)
.with_optional_query_param("per_page", per_page)
.execute(self.cfg)
.await
}
pub async fn get_feature(&self, id_or_code: String) -> Result<crate::models::Feature> {
crate::request::Request::new(http1::Method::GET, "/api/v1/features/{id_or_code}")
.with_path_param("id_or_code", id_or_code)
.execute(self.cfg)
.await
}
}