From ad662cf422cbb58912a96bb42baae338641707e7 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Thu, 19 Dec 2024 09:04:23 +0000 Subject: [PATCH] refactor(trello): pin down parameter types for create_card --- src/nextcloud/card.rs | 8 ++++++-- src/nextcloud/client.rs | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/nextcloud/card.rs b/src/nextcloud/card.rs index a4e4612..4b0007a 100644 --- a/src/nextcloud/card.rs +++ b/src/nextcloud/card.rs @@ -3,6 +3,7 @@ use std::path::PathBuf; use clap::Parser; +use crate::nextcloud::model::{NextcloudCardDescription, NextcloudCardTitle}; use crate::{execute::Execute, p, FullCtx}; #[derive(Parser, Debug)] @@ -82,8 +83,11 @@ impl Execute for NextcloudCardCommand { .create_card( (*board_id).into(), (*stack_id).into(), - title, - description.as_deref(), + &NextcloudCardTitle::new(title), + description + .as_ref() + .map(NextcloudCardDescription::new) + .as_ref(), ) .await; if *dump { diff --git a/src/nextcloud/client.rs b/src/nextcloud/client.rs index 04ab51d..fdbea72 100644 --- a/src/nextcloud/client.rs +++ b/src/nextcloud/client.rs @@ -8,7 +8,7 @@ use reqwest::multipart; use serde::de::DeserializeOwned; use serde_json::json; -use crate::nextcloud::model::NextcloudStackTitle; +use crate::nextcloud::model::{NextcloudCardDescription, NextcloudCardTitle, NextcloudStackTitle}; use crate::{ api_result::APIResult, f, @@ -162,8 +162,8 @@ impl<'ctx> DeckClient<'ctx> { &self, board_id: NextcloudBoardId, stack_id: NextcloudStackId, - title: &str, - description: Option<&str>, + title: &NextcloudCardTitle, + description: Option<&NextcloudCardDescription>, ) -> APIResult { let mut body = json!({ "title": title,