2024-11-30 11:30:36 +00:00
|
|
|
//
|
2024-12-04 19:37:39 +00:00
|
|
|
use derive_more::derive::Display;
|
2024-11-30 11:30:36 +00:00
|
|
|
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,
|
2024-12-04 19:37:39 +00:00
|
|
|
Display,
|
2024-11-30 11:30:36 +00:00
|
|
|
PartialOrd,
|
|
|
|
Ord,
|
|
|
|
"Title of the Board"
|
|
|
|
);
|
|
|
|
newtype!(
|
|
|
|
NextcloudBoardColour,
|
|
|
|
String,
|
|
|
|
PartialOrd,
|
|
|
|
Ord,
|
|
|
|
"Colour of the Board"
|
|
|
|
);
|
|
|
|
newtype!(
|
|
|
|
NextcloudStackTitle,
|
|
|
|
String,
|
2024-11-30 18:04:48 +00:00
|
|
|
Display,
|
2024-11-30 11:30:36 +00:00
|
|
|
PartialOrd,
|
|
|
|
Ord,
|
|
|
|
"Title of the Stack"
|
|
|
|
);
|
|
|
|
newtype!(
|
|
|
|
NextcloudCardTitle,
|
|
|
|
String,
|
2024-11-30 18:04:48 +00:00
|
|
|
Display,
|
2024-11-30 11:30:36 +00:00
|
|
|
PartialOrd,
|
|
|
|
Ord,
|
|
|
|
"Title of the Card"
|
|
|
|
);
|
2024-12-15 20:07:34 +00:00
|
|
|
newtype!(
|
|
|
|
NextcloudCardDescription,
|
|
|
|
String,
|
|
|
|
Display,
|
|
|
|
PartialOrd,
|
|
|
|
Ord,
|
|
|
|
"Description of the Card"
|
|
|
|
);
|
2024-11-30 11:30:36 +00:00
|
|
|
|
2024-11-29 14:31:40 +00:00
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
|
2024-12-08 17:23:54 +00:00
|
|
|
pub(crate) struct NextcloudBoardOwner {
|
2024-12-04 19:37:39 +00:00
|
|
|
#[serde(rename = "primaryKey")]
|
2024-12-08 17:23:54 +00:00
|
|
|
pub(crate) primary_key: String,
|
|
|
|
pub(crate) uid: String,
|
2024-12-04 19:37:39 +00:00
|
|
|
#[serde(rename = "displayname")]
|
2024-12-08 17:23:54 +00:00
|
|
|
pub(crate) display_name: String,
|
2024-12-04 19:37:39 +00:00
|
|
|
}
|
|
|
|
|
2024-11-29 14:31:40 +00:00
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
|
2024-12-08 17:23:54 +00:00
|
|
|
pub(crate) struct Board {
|
|
|
|
pub(crate) id: NextcloudBoardId,
|
|
|
|
pub(crate) title: NextcloudBoardTitle,
|
|
|
|
pub(crate) owner: NextcloudBoardOwner,
|
|
|
|
pub(crate) color: NextcloudBoardColour,
|
|
|
|
pub(crate) archived: bool,
|
|
|
|
pub(crate) labels: Vec<Label>,
|
|
|
|
pub(crate) acl: Vec<Acl>,
|
2024-11-30 11:30:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
|
2024-12-08 17:23:54 +00:00
|
|
|
pub(crate) struct Stack {
|
|
|
|
pub(crate) id: NextcloudStackId,
|
|
|
|
pub(crate) title: NextcloudStackTitle,
|
|
|
|
pub(crate) order: NextcloudOrder,
|
2024-11-30 11:30:36 +00:00
|
|
|
#[serde(rename = "boardId")]
|
2024-12-08 17:23:54 +00:00
|
|
|
pub(crate) board_id: NextcloudBoardId,
|
2024-11-30 11:30:36 +00:00
|
|
|
#[serde(rename = "ETag")]
|
2024-12-08 17:23:54 +00:00
|
|
|
pub(crate) etag: NextcloudETag,
|
2024-11-30 18:04:48 +00:00
|
|
|
#[serde(default)]
|
2024-12-08 17:23:54 +00:00
|
|
|
pub(crate) cards: Vec<Card>,
|
2024-11-30 11:30:36 +00:00
|
|
|
}
|
|
|
|
|
2024-11-30 18:04:48 +00:00
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
|
2024-12-08 17:23:54 +00:00
|
|
|
pub(crate) struct Card {
|
|
|
|
pub(crate) id: NextcloudCardId,
|
|
|
|
pub(crate) title: NextcloudCardTitle,
|
2024-12-15 20:07:34 +00:00
|
|
|
pub(crate) description: Option<NextcloudCardDescription>,
|
2024-11-30 11:30:36 +00:00
|
|
|
#[serde(rename = "stackId")]
|
2024-12-08 17:23:54 +00:00
|
|
|
pub(crate) stack_id: NextcloudStackId,
|
|
|
|
pub(crate) order: NextcloudOrder,
|
|
|
|
pub(crate) archived: bool,
|
2024-11-30 18:04:48 +00:00
|
|
|
#[serde(default)]
|
2024-12-08 17:23:54 +00:00
|
|
|
pub(crate) due_date: Option<String>,
|
2024-11-30 18:04:48 +00:00
|
|
|
#[serde(default)]
|
2024-12-08 17:23:54 +00:00
|
|
|
pub(crate) labels: Option<Vec<Label>>,
|
2024-11-30 11:30:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
|
2024-12-08 17:23:54 +00:00
|
|
|
pub(crate) struct Label {
|
|
|
|
pub(crate) id: NextcloudLabelId,
|
|
|
|
pub(crate) title: String,
|
|
|
|
pub(crate) color: String,
|
2024-11-30 11:30:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
|
2024-12-08 17:23:54 +00:00
|
|
|
pub(crate) struct Acl {
|
|
|
|
pub(crate) participant: String,
|
|
|
|
pub(crate) permission_edit: bool,
|
|
|
|
pub(crate) permission_share: bool,
|
|
|
|
pub(crate) permission_manage: bool,
|
2024-11-30 11:30:36 +00:00
|
|
|
}
|
2024-12-16 08:03:31 +00:00
|
|
|
|
|
|
|
// {"id":92,"cardId":332,"type":"file","data":"async-rust-book (2).webp","lastModified":1734506800,"createdAt":1734506800,"createdBy":"pcampbell","
|
|
|
|
// deletedAt":0,"extendedData":{"path":"\/Deck\/async-rust-book (2).webp","fileid":746424,"data":"async-rust-book (2).webp","filesize":137128,"mimetype":"image\/webp","info":{"dirname":".","basename":
|
|
|
|
// "async-rust-book (2).webp","extension":"webp","filename":"async-rust-book (2)"},"hasPreview":true,"permissions":1,"attachmentCreator":{"displayName":"Paul Campbell","id":"pcampbell","email":"pcampb
|
|
|
|
// ell@kemitix.net"}}}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
|
|
|
|
pub(crate) struct Attachment {
|
|
|
|
pub(crate) id: i64,
|
|
|
|
#[serde(rename = "cardId")]
|
|
|
|
pub(crate) card_id: i64,
|
|
|
|
#[serde(rename = "type")]
|
|
|
|
pub(crate) attachment_type: String,
|
|
|
|
pub(crate) data: String,
|
|
|
|
#[serde(rename = "lastModified")]
|
|
|
|
pub(crate) last_modified: i64,
|
|
|
|
#[serde(rename = "createdAt")]
|
|
|
|
pub(crate) created_at: i64,
|
|
|
|
#[serde(rename = "createdBy")]
|
|
|
|
pub(crate) created_by: String,
|
|
|
|
#[serde(rename = "deletedAt")]
|
|
|
|
pub(crate) deleted_at: i64,
|
|
|
|
#[serde(rename = "extendedData")]
|
|
|
|
pub(crate) extended_data: AttachmentExtendedData,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
|
|
|
|
pub(crate) struct AttachmentExtendedData {
|
|
|
|
pub(crate) path: String,
|
|
|
|
pub(crate) fileid: i64,
|
|
|
|
pub(crate) data: String,
|
|
|
|
pub(crate) filesize: i64,
|
|
|
|
pub(crate) mimetype: String,
|
|
|
|
pub(crate) info: AttachmentInfo,
|
|
|
|
#[serde(rename = "hasPreview")]
|
|
|
|
pub(crate) has_preview: bool,
|
|
|
|
pub(crate) permissions: i64,
|
|
|
|
#[serde(rename = "attachmentCreator")]
|
|
|
|
pub(crate) attachment_creator: AttachmentCreator,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
|
|
|
|
pub(crate) struct AttachmentInfo {
|
|
|
|
pub(crate) dirname: String,
|
|
|
|
pub(crate) basename: String,
|
|
|
|
pub(crate) extension: String,
|
|
|
|
pub(crate) filename: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
|
|
|
|
pub(crate) struct AttachmentCreator {
|
|
|
|
#[serde(rename = "displayName")]
|
|
|
|
pub(crate) display_name: String,
|
|
|
|
pub(crate) id: String,
|
|
|
|
pub(crate) email: String,
|
|
|
|
}
|