Add missing fields to single post and fix README example
This commit is contained in:
parent
bbe42ba1ee
commit
909632a1a4
6 changed files with 48 additions and 9 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -574,7 +574,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "r621"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64",
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -55,6 +55,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
};
|
||||
|
||||
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?;
|
||||
}
|
||||
```
|
|
@ -1 +0,0 @@
|
|||
enum Error {}
|
|
@ -1,5 +1,4 @@
|
|||
pub mod client;
|
||||
pub mod errors;
|
||||
pub mod post;
|
||||
pub mod query;
|
||||
|
||||
|
|
49
src/post.rs
49
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<String>,
|
||||
pub change_seq: Option<u128>,
|
||||
pub flags: PostFlags,
|
||||
pub rating: String,
|
||||
pub fav_count: u16,
|
||||
pub sources: Vec<String>,
|
||||
pub pools: Vec<Id>,
|
||||
pub relationships: PostRelationships,
|
||||
pub approver_id: Option<Id>,
|
||||
pub uploader_id: Id,
|
||||
pub description: String,
|
||||
pub comment_count: u16,
|
||||
pub has_notes: bool,
|
||||
pub is_favorited: bool,
|
||||
pub change_seq: Option<u128>,
|
||||
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<Id>,
|
||||
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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue