Skip to main content

late/models/
reddit_post.rs

1/*
2 * Zernio API
3 *
4 * API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
5 *
6 * The version of the OpenAPI document: 1.0.1
7 * Contact: support@zernio.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// RedditPost : A normalized Reddit post returned by the feed and search endpoints
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct RedditPost {
17    /// Reddit post ID (without type prefix)
18    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
19    pub id: Option<String>,
20    /// Reddit fullname (e.g. t3_abc123)
21    #[serde(rename = "fullname", skip_serializing_if = "Option::is_none")]
22    pub fullname: Option<String>,
23    #[serde(rename = "title", skip_serializing_if = "Option::is_none")]
24    pub title: Option<String>,
25    #[serde(rename = "author", skip_serializing_if = "Option::is_none")]
26    pub author: Option<String>,
27    #[serde(rename = "subreddit", skip_serializing_if = "Option::is_none")]
28    pub subreddit: Option<String>,
29    /// Post URL (may be a gallery URL
30    #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
31    pub url: Option<String>,
32    /// Full permalink to the Reddit post
33    #[serde(rename = "permalink", skip_serializing_if = "Option::is_none")]
34    pub permalink: Option<String>,
35    /// Self-post body text (empty string for link posts)
36    #[serde(rename = "selftext", skip_serializing_if = "Option::is_none")]
37    pub selftext: Option<String>,
38    /// Unix timestamp of post creation
39    #[serde(rename = "createdUtc", skip_serializing_if = "Option::is_none")]
40    pub created_utc: Option<f64>,
41    #[serde(rename = "score", skip_serializing_if = "Option::is_none")]
42    pub score: Option<i32>,
43    #[serde(rename = "numComments", skip_serializing_if = "Option::is_none")]
44    pub num_comments: Option<i32>,
45    /// Whether the post is marked NSFW
46    #[serde(rename = "over18", skip_serializing_if = "Option::is_none")]
47    pub over18: Option<bool>,
48    #[serde(rename = "stickied", skip_serializing_if = "Option::is_none")]
49    pub stickied: Option<bool>,
50    /// Link flair text if set
51    #[serde(rename = "flairText", skip_serializing_if = "Option::is_none")]
52    pub flair_text: Option<String>,
53    /// Whether the post is a gallery with multiple images
54    #[serde(rename = "isGallery", skip_serializing_if = "Option::is_none")]
55    pub is_gallery: Option<bool>,
56    /// Individual image URLs for gallery posts (only present when isGallery is true)
57    #[serde(rename = "galleryImages", skip_serializing_if = "Option::is_none")]
58    pub gallery_images: Option<Vec<String>>,
59}
60
61impl RedditPost {
62    /// A normalized Reddit post returned by the feed and search endpoints
63    pub fn new() -> RedditPost {
64        RedditPost {
65            id: None,
66            fullname: None,
67            title: None,
68            author: None,
69            subreddit: None,
70            url: None,
71            permalink: None,
72            selftext: None,
73            created_utc: None,
74            score: None,
75            num_comments: None,
76            over18: None,
77            stickied: None,
78            flair_text: None,
79            is_gallery: None,
80            gallery_images: None,
81        }
82    }
83}