use serde::Serialize;
use crate::{
api::{Method, Payload, PayloadError},
types::Integer,
};
#[derive(Clone, Debug, Serialize)]
pub struct EditUserStarSubscription {
user_id: Integer,
telegram_payment_charge_id: String,
is_canceled: bool,
}
impl EditUserStarSubscription {
pub fn new<T>(user_id: Integer, telegram_payment_charge_id: T, is_canceled: bool) -> Self
where
T: Into<String>,
{
Self {
user_id,
telegram_payment_charge_id: telegram_payment_charge_id.into(),
is_canceled,
}
}
}
impl Method for EditUserStarSubscription {
type Response = bool;
fn into_payload(self) -> Result<Payload, PayloadError> {
Payload::json("editUserStarSubscription", self)
}
}