use serde_json::json;
use crate::model::*;
use crate::FluentRequest;
use serde::{Serialize, Deserialize};
use httpclient::InMemoryResponseExt;
use crate::StripeClient;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GetPricesSearchRequest {
pub expand: Option<Vec<String>>,
pub limit: Option<i64>,
pub page: Option<String>,
pub query: String,
}
impl GetPricesSearchRequest {}
impl FluentRequest<'_, GetPricesSearchRequest> {
pub fn expand(mut self, expand: impl IntoIterator<Item = impl AsRef<str>>) -> Self {
self
.params
.expand = Some(expand.into_iter().map(|s| s.as_ref().to_owned()).collect());
self
}
pub fn limit(mut self, limit: i64) -> Self {
self.params.limit = Some(limit);
self
}
pub fn page(mut self, page: &str) -> Self {
self.params.page = Some(page.to_owned());
self
}
}
impl<'a> ::std::future::IntoFuture for FluentRequest<'a, GetPricesSearchRequest> {
type Output = httpclient::InMemoryResult<SearchResult>;
type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
fn into_future(self) -> Self::IntoFuture {
Box::pin(async {
let url = "/v1/prices/search";
let mut r = self.client.client.get(url);
r = r.set_query(self.params);
r = self.client.authenticate(r);
let res = r.await?;
res.json().map_err(Into::into)
})
}
}