feat: use more non-String types
This commit is contained in:
parent
9e414d8947
commit
3552faf7a9
2 changed files with 16 additions and 8 deletions
|
@ -2,7 +2,7 @@
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
|
|
||||||
use crate::execute::Execute;
|
use crate::execute::Execute;
|
||||||
use crate::nextcloud::model::NextcloudLabelId;
|
use crate::nextcloud::model::{NextcloudCardDescription, NextcloudCardTitle, NextcloudLabelId};
|
||||||
use crate::{
|
use crate::{
|
||||||
nextcloud::model::{NextcloudCardId, NextcloudStackId},
|
nextcloud::model::{NextcloudCardId, NextcloudStackId},
|
||||||
p, FullCtx,
|
p, FullCtx,
|
||||||
|
@ -69,9 +69,9 @@ impl Execute for NextcloudCardCommand {
|
||||||
ctx,
|
ctx,
|
||||||
Create {
|
Create {
|
||||||
dump: *dump,
|
dump: *dump,
|
||||||
stack_id: (*stack_id),
|
stack_id: (*stack_id).into(),
|
||||||
title: title.clone(),
|
title: title.clone().into(),
|
||||||
description: description.clone(),
|
description: description.clone().map(|d| d.into()),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
|
@ -139,9 +139,9 @@ pub(crate) async fn get(
|
||||||
|
|
||||||
pub(crate) struct Create {
|
pub(crate) struct Create {
|
||||||
pub(crate) dump: bool,
|
pub(crate) dump: bool,
|
||||||
pub(crate) stack_id: i64,
|
pub(crate) stack_id: NextcloudStackId,
|
||||||
pub(crate) title: String,
|
pub(crate) title: NextcloudCardTitle,
|
||||||
pub(crate) description: Option<String>,
|
pub(crate) description: Option<NextcloudCardDescription>,
|
||||||
}
|
}
|
||||||
pub(crate) async fn create(ctx: &FullCtx, create: Create) -> color_eyre::Result<()> {
|
pub(crate) async fn create(ctx: &FullCtx, create: Create) -> color_eyre::Result<()> {
|
||||||
let api_result = ctx.deck_client().create_card(&create).await;
|
let api_result = ctx.deck_client().create_card(&create).await;
|
||||||
|
|
|
@ -111,6 +111,14 @@ newtype!(
|
||||||
Ord,
|
Ord,
|
||||||
"Title of the Card"
|
"Title of the Card"
|
||||||
);
|
);
|
||||||
|
newtype!(
|
||||||
|
NextcloudCardDescription,
|
||||||
|
String,
|
||||||
|
Display,
|
||||||
|
PartialOrd,
|
||||||
|
Ord,
|
||||||
|
"Description of the Card"
|
||||||
|
);
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
pub(crate) struct NextcloudBoardOwner {
|
pub(crate) struct NextcloudBoardOwner {
|
||||||
|
@ -149,7 +157,7 @@ pub(crate) struct Stack {
|
||||||
pub(crate) struct Card {
|
pub(crate) struct Card {
|
||||||
pub(crate) id: NextcloudCardId,
|
pub(crate) id: NextcloudCardId,
|
||||||
pub(crate) title: NextcloudCardTitle,
|
pub(crate) title: NextcloudCardTitle,
|
||||||
pub(crate) description: Option<String>,
|
pub(crate) description: Option<NextcloudCardDescription>,
|
||||||
#[serde(rename = "stackId")]
|
#[serde(rename = "stackId")]
|
||||||
pub(crate) stack_id: NextcloudStackId,
|
pub(crate) stack_id: NextcloudStackId,
|
||||||
pub(crate) order: NextcloudOrder,
|
pub(crate) order: NextcloudOrder,
|
||||||
|
|
Loading…
Reference in a new issue