use std::{
future::{Future, IntoFuture},
pin::Pin,
};
use serde::Serialize;
use crate::{
api::API, entities::star_transactions::StarTransactions, errors::ConogramError,
impl_into_future, request::RequestT,
};
#[derive(Debug, Clone, Serialize)]
pub struct GetStarTransactionsParams {
#[serde(skip_serializing_if = "Option::is_none")]
pub offset: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
}
impl_into_future!(GetStarTransactionsRequest<'a>);
#[derive(Clone)]
pub struct GetStarTransactionsRequest<'a> {
api: &'a API,
params: GetStarTransactionsParams,
}
impl<'a> RequestT for GetStarTransactionsRequest<'a> {
type ParamsType = GetStarTransactionsParams;
type ReturnType = StarTransactions;
fn get_name() -> &'static str {
"getStarTransactions"
}
fn get_api_ref(&self) -> &API {
self.api
}
fn get_params_ref(&self) -> &Self::ParamsType {
&self.params
}
fn is_multipart() -> bool {
false
}
}
impl<'a> GetStarTransactionsRequest<'a> {
pub fn new(api: &'a API) -> Self {
Self {
api,
params: GetStarTransactionsParams {
offset: Option::default(),
limit: Option::default(),
},
}
}
#[must_use]
pub fn offset(mut self, offset: impl Into<i64>) -> Self {
self.params.offset = Some(offset.into());
self
}
#[must_use]
pub fn limit(mut self, limit: impl Into<i64>) -> Self {
self.params.limit = Some(limit.into());
self
}
}
impl API {
pub fn get_star_transactions(&self) -> GetStarTransactionsRequest {
GetStarTransactionsRequest::new(self)
}
}