From d7361ee5e583e39af3538c33fd463e58eebe38fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20Gr=C3=BCnewald?= Date: Mon, 1 Jan 2024 21:50:57 +0100 Subject: [PATCH] Add basic posts struct --- src/lib.rs | 1 + src/post.rs | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/post.rs diff --git a/src/lib.rs b/src/lib.rs index b79c47f..e2a1b85 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1 +1,2 @@ mod client; +mod post; diff --git a/src/post.rs b/src/post.rs new file mode 100644 index 0000000..a1b1c1e --- /dev/null +++ b/src/post.rs @@ -0,0 +1,40 @@ +pub type Id = u64; +pub type FileSize = u64; +pub type ImageDimension = u64; + +pub struct Post { + id: Id, + created_at: String, + updated_at: String, + tags: PostTags, + file: PostFile, + rating: String, + fav_count: u16, + sources: Vec, + approver_id: Id, + uploader_ud: Id, + description: String, + comment_count: u16, + has_notes: bool, + is_favorited: bool, + change_seq: u128 +} + +pub struct PostTags { + general: Vec, + artist: Vec, + copyright: Vec, + character: Vec, + invalid: Vec, + meta: Vec, + lore: Vec +} + +pub struct PostFile { + width: ImageDimension, + height: ImageDimension, + ext: String, + size: FileSize, + md5: String, + url: String +}