use reqwest::Method;
use super::types::{ClaimReferralRequest, DynamicResponse};
use crate::{Error, HttpClient};
pub struct ReferralApi<'a> {
http: &'a HttpClient,
}
impl<'a> ReferralApi<'a> {
pub fn new(http: &'a HttpClient) -> Self {
Self { http }
}
pub async fn claim_referral(
&self,
request: &ClaimReferralRequest,
) -> Result<DynamicResponse, Error> {
let body = serde_json::to_value(request).expect("referral request is serializable");
self.http
.send_typed(Method::POST, "/referral/claim", &[], Some(&body), true)
.await
}
pub async fn get_referral_stats(&self) -> Result<DynamicResponse, Error> {
self.http
.send_typed(Method::GET, "/referral/stats", &[], None, true)
.await
}
}