From d9070421df2ee4a8d4f14096009bee6b7fba1e00 Mon Sep 17 00:00:00 2001 From: Igor Bubelov Date: Sat, 25 Jan 2025 17:31:41 +0700 Subject: [PATCH] Add new paywall commands --- src/command/element.rs | 14 -------------- src/command/mod.rs | 1 + src/command/paywall.rs | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 14 deletions(-) create mode 100644 src/command/paywall.rs diff --git a/src/command/element.rs b/src/command/element.rs index 5b9f29d..5257c96 100644 --- a/src/command/element.rs +++ b/src/command/element.rs @@ -51,20 +51,6 @@ pub fn add_element_comment(args: &AddElementCommentArgs) -> Result<()> { .print() } -#[derive(Args)] -pub struct AddPaidElementCommentArgs { - pub id: String, - pub comment: String, -} - -pub fn add_paid_element_comment(args: &AddPaidElementCommentArgs) -> Result<()> { - rpc::call( - "add_paid_element_comment", - json!({"element_id": args.id,"comment": args.comment}), - )? - .print() -} - #[derive(Args)] pub struct BoostElementArgs { pub id: String, diff --git a/src/command/mod.rs b/src/command/mod.rs index 8d3aec4..57acadd 100644 --- a/src/command/mod.rs +++ b/src/command/mod.rs @@ -2,6 +2,7 @@ pub mod admin; pub mod area; pub mod common; pub mod element; +pub mod paywall; pub mod report; pub mod setup; pub mod user; diff --git a/src/command/paywall.rs b/src/command/paywall.rs new file mode 100644 index 0000000..7078e19 --- /dev/null +++ b/src/command/paywall.rs @@ -0,0 +1,39 @@ +use crate::{rpc, Result}; +use clap::Args; +use serde_json::json; + +pub fn paywall_get_add_element_comment_quote() -> Result<()> { + rpc::call("paywall_get_add_element_comment_quote", json!({}))?.print() +} + +#[derive(Args)] +pub struct PaywallAddElementCommentArgs { + pub element_id: String, + pub comment: String, +} + +pub fn paywall_add_element_comment(args: &PaywallAddElementCommentArgs) -> Result<()> { + rpc::call( + "paywall_add_element_comment", + json!({"element_id": args.element_id,"comment": args.comment}), + )? + .print() +} + +pub fn paywall_get_boost_element_quote() -> Result<()> { + rpc::call("paywall_get_boost_element_quote", json!({}))?.print() +} + +#[derive(Args)] +pub struct PaywallBoostElementArgs { + pub element_id: String, + pub days: i64, +} + +pub fn paywall_boost_element(args: &PaywallBoostElementArgs) -> Result<()> { + rpc::call( + "paywall_boost_element", + json!({"element_id": args.element_id, "days": args.days}), + )? + .print() +}