trello-to-deck/src/nextcloud/model.rs

171 lines
3.2 KiB
Rust
Raw Normal View History

//
use derive_more::derive::Display;
use serde::{Deserialize, Serialize};
use crate::newtype;
newtype!(
NextcloudHostname,
String,
Display,
PartialOrd,
Ord,
"Hostname of the Nextcloud server"
);
newtype!(
NextcloudUsername,
String,
Display,
PartialOrd,
Ord,
"Username to authenticate as"
);
newtype!(
NextcloudPassword,
String,
PartialOrd,
Ord,
"Password to authenticate with"
);
newtype!(
NextcloudBoardId,
i64,
Copy,
Display,
PartialOrd,
Ord,
"ID of a Nextcloud Board"
);
newtype!(
NextcloudStackId,
i64,
Copy,
Display,
PartialOrd,
Ord,
"ID of a Nextcloud Stack"
);
newtype!(
NextcloudCardId,
i64,
Copy,
Display,
PartialOrd,
Ord,
"ID of a Nextcloud Card"
);
newtype!(
NextcloudLabelId,
i64,
Copy,
Display,
PartialOrd,
Ord,
"ID of a Nextcloud Label"
);
newtype!(
NextcloudOrder,
i64,
Copy,
Display,
PartialOrd,
Ord,
"Relative position of the item amongst its peers"
);
newtype!(
NextcloudETag,
String,
PartialOrd,
Ord,
"ETag for a resource"
);
newtype!(
NextcloudBoardTitle,
String,
Display,
PartialOrd,
Ord,
"Title of the Board"
);
newtype!(
NextcloudBoardColour,
String,
PartialOrd,
Ord,
"Colour of the Board"
);
newtype!(
NextcloudStackTitle,
String,
PartialOrd,
Ord,
"Title of the Stack"
);
newtype!(
NextcloudCardTitle,
String,
PartialOrd,
Ord,
"Title of the Card"
);
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
pub struct NextcloudBoardOwner {
#[serde(rename = "primaryKey")]
pub primary_key: String,
pub uid: String,
#[serde(rename = "displayname")]
pub display_name: String,
}
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
pub struct Board {
pub id: NextcloudBoardId,
pub title: NextcloudBoardTitle,
pub owner: NextcloudBoardOwner,
pub color: NextcloudBoardColour,
pub archived: bool,
pub labels: Vec<Label>,
pub acl: Vec<Acl>,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
pub struct Stack {
pub id: NextcloudStackId,
pub title: NextcloudStackTitle,
pub order: NextcloudOrder,
#[serde(rename = "boardId")]
pub board_id: NextcloudBoardId,
#[serde(rename = "ETag")]
pub etag: NextcloudETag,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Card {
pub id: NextcloudCardId,
pub title: NextcloudCardTitle,
pub description: Option<String>,
#[serde(rename = "stackId")]
pub stack_id: NextcloudStackId,
pub order: NextcloudOrder,
pub archived: bool,
pub due_date: Option<String>,
pub labels: Vec<NextcloudLabelId>,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
pub struct Label {
pub id: NextcloudLabelId,
pub title: String,
pub color: String,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
pub struct Acl {
pub participant: String,
pub permission_edit: bool,
pub permission_share: bool,
pub permission_manage: bool,
}