mangadex_api_schema_rust/v5/
author.rs

1use mangadex_api_types::{MangaDexDateTime, RelationshipType};
2use serde::Deserialize;
3use url::Url;
4
5use crate::{
6    TypedAttributes,
7    v5::{LocalizedString, localizedstring_array_or_map},
8};
9
10/// General author information.
11#[derive(Clone, Debug, Deserialize, PartialEq, Default)]
12#[serde(rename_all = "camelCase")]
13#[non_exhaustive]
14#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
15#[cfg_attr(feature = "specta", derive(specta::Type))]
16pub struct AuthorAttributes {
17    pub name: String,
18    pub image_url: Option<String>,
19    #[serde(with = "localizedstring_array_or_map")]
20    pub biography: LocalizedString,
21    /// <https://twitter.com>
22    #[cfg_attr(feature = "specta", specta(type = Option<String>))]
23    pub twitter: Option<Url>,
24    /// <https://www.pixiv.net>
25    #[cfg_attr(feature = "specta", specta(type = Option<String>))]
26    pub pixiv: Option<Url>,
27    /// <https://www.melonbooks.co.jp>
28    #[cfg_attr(feature = "specta", specta(type = Option<String>))]
29    pub melon_book: Option<Url>,
30    /// <https://www.fanbox.cc>
31    #[cfg_attr(feature = "specta", specta(type = Option<String>))]
32    pub fan_box: Option<Url>,
33    /// <https://booth.pm>
34    #[cfg_attr(feature = "specta", specta(type = Option<String>))]
35    pub booth: Option<Url>,
36    /// <https://www.nicovideo.jp>
37    #[cfg_attr(feature = "specta", specta(type = Option<String>))]
38    pub nico_video: Option<Url>,
39    /// <https://skeb.jp>
40    #[cfg_attr(feature = "specta", specta(type = Option<String>))]
41    pub skeb: Option<Url>,
42    /// <https://fantia.jp>
43    #[cfg_attr(feature = "specta", specta(type = Option<String>))]
44    pub fantia: Option<Url>,
45    /// <https://www.tumblr.com>
46    #[cfg_attr(feature = "specta", specta(type = Option<String>))]
47    pub tumblr: Option<Url>,
48    /// <https://www.youtube.com>
49    #[cfg_attr(feature = "specta", specta(type = Option<String>))]
50    pub youtube: Option<Url>,
51    /// [https://weibo.cn/u/](https://weibo.cn)
52    /// or
53    /// [https://m.weibo.cn/u/](https://m.weibo.cn)
54    #[cfg_attr(feature = "specta", specta(type = Option<String>))]
55    pub weibo: Option<Url>,
56    /// <https://blog.naver.com/>
57    #[cfg_attr(feature = "specta", specta(type = Option<String>))]
58    pub naver: Option<Url>,
59    /// <https://blog.naver.com/>
60    #[cfg_attr(feature = "specta", specta(type = Option<String>))]
61    pub namicomi: Option<Url>,
62    #[cfg_attr(feature = "specta", specta(type = Option<String>))]
63    pub website: Option<Url>,
64    pub version: u32,
65    /// Datetime in `YYYY-MM-DDTHH:MM:SS+HH:MM` format.
66    #[cfg_attr(feature = "specta", specta(type = String))]
67    #[cfg_attr(
68        feature = "serialize",
69        serde(serialize_with = "crate::v5::mangadex_datetime_serialize")
70    )]
71    pub created_at: MangaDexDateTime,
72    /// Datetime in `YYYY-MM-DDTHH:MM:SS+HH:MM` format.
73    #[cfg_attr(feature = "specta", specta(type = Option<String>))]
74    #[cfg_attr(
75        feature = "serialize",
76        serde(serialize_with = "crate::v5::mangadex_datetime_serialize_option")
77    )]
78    pub updated_at: Option<MangaDexDateTime>,
79}
80
81impl TypedAttributes for AuthorAttributes {
82    const TYPE_: RelationshipType = RelationshipType::Author;
83}