diff --git a/Cargo.lock b/Cargo.lock index da5d420..1063c3d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -574,7 +574,7 @@ dependencies = [ [[package]] name = "r621" -version = "0.2.1" +version = "0.2.2" dependencies = [ "anyhow", "base64", diff --git a/Cargo.toml b/Cargo.toml index 5f1186c..2994e98 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "r621" -version = "0.2.1" +version = "0.2.2" edition = "2021" description = "Provides a client to access e621" homepage = "https://git.doggoat.de/dhalucario/r621" diff --git a/README.md b/README.md index 2c9ce52..88574da 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,6 @@ async fn main() -> Result<(), Box> { }; let mut esix_client = Client::new(auth, user_agent); - let posts = esix_client.list_posts(None, query, None).await?; + let posts = esix_client.list_posts(None, Some(String::from("lucario")), None).await?; } ``` \ No newline at end of file diff --git a/src/errors.rs b/src/errors.rs deleted file mode 100644 index 5a26c02..0000000 --- a/src/errors.rs +++ /dev/null @@ -1 +0,0 @@ -enum Error {} diff --git a/src/lib.rs b/src/lib.rs index 123e78d..c7fde37 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,4 @@ pub mod client; -pub mod errors; pub mod post; pub mod query; diff --git a/src/post.rs b/src/post.rs index 63178e0..011e9d8 100644 --- a/src/post.rs +++ b/src/post.rs @@ -1,6 +1,7 @@ pub type Id = u64; pub type FileSize = u64; pub type ImageDimension = u64; +pub type VoteCount = i32; #[derive(serde::Serialize, serde::Deserialize, Clone, Debug)] pub struct RawPost { @@ -31,19 +32,27 @@ pub struct Post { pub id: Id, pub created_at: String, pub updated_at: String, - pub tags: PostTags, pub file: PostFile, + pub preview: PostPreview, + pub sample: PostSample, + pub score: PostScore, + pub tags: PostTags, + pub locked_tags: Vec, + pub change_seq: Option, + pub flags: PostFlags, pub rating: String, pub fav_count: u16, pub sources: Vec, + pub pools: Vec, + pub relationships: PostRelationships, pub approver_id: Option, pub uploader_id: Id, pub description: String, pub comment_count: u16, - pub has_notes: bool, pub is_favorited: bool, - pub change_seq: Option, - pub relationships: PostRelationships, + + // Not documented? + pub has_notes: bool } #[derive(serde::Serialize, serde::Deserialize, Clone, Debug)] @@ -68,9 +77,41 @@ pub struct PostFile { pub url: String, } +#[derive(serde::Serialize, serde::Deserialize, Clone, Debug)] +pub struct PostPreview { + width: ImageDimension, + height: ImageDimension, + url: String +} + +#[derive(serde::Serialize, serde::Deserialize, Clone, Debug)] +pub struct PostSample { + has: bool, + width: ImageDimension, + height: ImageDimension, + url: String +} + +#[derive(serde::Serialize, serde::Deserialize, Clone, Debug)] +pub struct PostScore { + pub up: VoteCount, + pub down: VoteCount, + pub total: VoteCount, +} + #[derive(serde::Serialize, serde::Deserialize, Clone, Debug)] pub struct PostRelationships { pub parent_id: Option, pub has_children: bool, pub has_active_children: bool, } + +#[derive(serde::Serialize, serde::Deserialize, Clone, Debug)] +pub struct PostFlags { + pub pending: bool, + pub flagged: bool, + pub note_locked: bool, + pub statued_locked: bool, + pub rating_locked: bool, + pub deleted: bool +}