Skip to content

Commit

Permalink
Add add-paid-element-comment command
Browse files Browse the repository at this point in the history
  • Loading branch information
bubelov committed Jan 16, 2025
1 parent 82cebfe commit 2373386
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/command/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ pub fn generate_invoice(args: &GenerateInvoiceArgs) -> Result<()> {
#[derive(Args)]
pub struct SyncUnpaidInvoicesArgs {}

pub fn sync_unpaid_invoices(args: &SyncUnpaidInvoicesArgs) -> Result<()> {
pub fn sync_unpaid_invoices(_args: &SyncUnpaidInvoicesArgs) -> Result<()> {
rpc::call("sync_unpaid_invoices", json!({}))?.print()
}
14 changes: 14 additions & 0 deletions src/command/element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,20 @@ 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,
Expand Down
3 changes: 3 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ enum Commands {
RemoveElementTag(command::element::RemoveElementTagArgs),
/// Add coment to a certain element. You can use either numeric or OSM (node:12345) id
AddElementComment(command::element::AddElementCommentArgs),
/// Add paid coment to a certain element. You can use either numeric or OSM (node:12345) id
AddPaidElementComment(command::element::AddPaidElementCommentArgs),
/// Boost an element for a set number of days. You can use either numeric or OSM (node:12345) id
BoostElement(command::element::BoostElementArgs),
/// Get all boosted elements
Expand Down Expand Up @@ -130,6 +132,7 @@ fn main() -> Result<()> {
Commands::SetElementTag(args) => element::set_element_tag(args),
Commands::RemoveElementTag(args) => element::remove_element_tag(args),
Commands::AddElementComment(args) => element::add_element_comment(args),
Commands::AddPaidElementComment(args) => element::add_paid_element_comment(args),
Commands::BoostElement(args) => element::boost_element(args),
Commands::GetBoostedElements(args) => element::get_boosted_elements(args),
Commands::SyncElements(args) => element::sync_elements(args),
Expand Down

0 comments on commit 2373386

Please sign in to comment.