wp_mini/field/
part_field.rs

1use crate::field::text_url_field::TextUrlField;
2use crate::field::{AuthRequiredFields, DefaultableFields, StoryField};
3use crate::impl_field_display;
4use strum_macros::AsRefStr;
5
6/// Represents the fields that can be requested for a `Part` object from the Wattpad API.
7#[derive(Debug, Clone, AsRefStr, PartialEq, Eq, Ord, PartialOrd, Hash)]
8#[strum(serialize_all = "camelCase")]
9pub enum PartField {
10    /// The unique numerical identifier of the story part.
11    Id,
12    /// The title of the story part.
13    Title,
14    /// A direct URL to the story part on the Wattpad website.
15    Url,
16
17    /// A complex field for URLs related to the part's text content, with selectable sub-fields.
18    #[strum(disabled)]
19    TextUrl(Vec<TextUrlField>),
20
21    /// The content rating of the story part.
22    Rating,
23    /// A boolean flag indicating whether the part is a draft.
24    Draft,
25    /// The timestamp when the part was last modified.
26    ModifyDate,
27    /// The timestamp when the part was created.
28    CreateDate,
29    /// A boolean flag indicating if the part contains images that have been banned.
30    HasBannedImages,
31    /// The length of the story part, often representing an estimated reading time in seconds.
32    Length,
33    /// The ID of any video associated with the part.
34    VideoID,
35    /// The URL for the part's cover image.
36    PhotoUrl,
37    /// The total number of comments on the part.
38    CommentCount,
39    /// The total number of votes the part has received.
40    VoteCount,
41    /// The total number of reads the part has received.
42    ReadCount,
43    /// The unique identifier of the parent story (also known as group ID).
44    GroupId,
45
46    /// The parent story.
47    #[strum(disabled)]
48    Group(Vec<StoryField>),
49
50    /// A boolean flag indicating whether the part has been deleted.
51    Deleted,
52}
53
54impl_field_display!(
55    PartField,
56    TextUrl => "text_url",
57    Group => "group"
58);
59
60impl AuthRequiredFields for PartField {}
61
62impl DefaultableFields for PartField {
63    fn default_fields() -> Vec<Self> {
64        vec![Self::Id, Self::Title, Self::Url]
65    }
66}