diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..fac5529 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +profile = "default" +channel = "nightly-2023-12-27" diff --git a/src/api/fav/get_list.rs b/src/api/fav/get_list.rs index c443f65..82f2120 100644 --- a/src/api/fav/get_list.rs +++ b/src/api/fav/get_list.rs @@ -10,14 +10,12 @@ use serde::{Deserialize, Serialize}; use std::ops::ControlFlow; #[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] pub struct FavEntry { - #[serde(rename = "Title")] pub title: String, #[serde(rename = "LinkUrl")] pub url: String, - #[serde(rename = "Summary")] pub summary: String, - #[serde(rename = "Tags")] pub tags: Vec, #[serde(rename = "DateAdded")] pub create_time: String, diff --git a/src/api/ing/get_comment_list.rs b/src/api/ing/get_comment_list.rs index d925f00..59ac871 100644 --- a/src/api/ing/get_comment_list.rs +++ b/src/api/ing/get_comment_list.rs @@ -7,24 +7,18 @@ use anyhow::Result; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] pub struct IngCommentEntry { - #[serde(rename = "Id")] pub id: usize, - #[serde(rename = "Content")] pub content: String, #[serde(rename = "DateAdded")] pub create_time: String, - #[serde(rename = "StatusId")] pub status_id: usize, - #[serde(rename = "UserAlias")] pub user_alias: String, #[serde(rename = "UserDisplayName")] pub user_name: String, - #[serde(rename = "UserIconUrl")] pub user_icon_url: String, - #[serde(rename = "UserId")] pub user_id: usize, - #[serde(rename = "UserGuid")] pub user_guid: String, } diff --git a/src/api/ing/get_list.rs b/src/api/ing/get_list.rs index dd542a7..5eca27a 100644 --- a/src/api/ing/get_list.rs +++ b/src/api/ing/get_list.rs @@ -10,30 +10,21 @@ use serde::{Deserialize, Serialize}; use std::ops::ControlFlow; #[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] pub struct IngEntry { - #[serde(rename = "Id")] pub id: usize, - #[serde(rename = "Content")] pub content: String, - #[serde(rename = "IsPrivate")] pub is_private: bool, - #[serde(rename = "IsLucky")] pub is_lucky: bool, - #[serde(rename = "CommentCount")] pub comment_count: usize, #[serde(rename = "DateAdded")] pub create_time: String, - #[serde(rename = "UserAlias")] pub user_alias: String, #[serde(rename = "UserDisplayName")] pub user_name: String, - #[serde(rename = "UserIconUrl")] pub user_icon_url: String, - #[serde(rename = "UserId")] pub user_id: usize, - #[serde(rename = "UserGuid")] pub user_guid: String, - #[serde(rename = "SendFrom")] pub send_from: IngSendFrom, #[serde(rename = "Icons")] pub icons: String, diff --git a/src/api/news/get_list.rs b/src/api/news/get_list.rs index 7b1bbf8..23ff0b3 100644 --- a/src/api/news/get_list.rs +++ b/src/api/news/get_list.rs @@ -8,22 +8,16 @@ use anyhow::Result; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] pub struct NewsEntry { - #[serde(rename = "Id")] pub id: usize, - #[serde(rename = "Title")] pub title: String, - #[serde(rename = "Summary")] pub summary: String, - #[serde(rename = "TopicId")] pub topic_id: usize, #[serde(rename = "TopicIcon")] pub topic_icon_url: Option, - #[serde(rename = "ViewCount")] pub view_count: usize, - #[serde(rename = "CommentCount")] pub comment_count: usize, - #[serde(rename = "DiggCount")] pub digg_count: usize, #[serde(rename = "DateAdded")] pub create_time: String, diff --git a/src/api/post/get_comment_list.rs b/src/api/post/get_comment_list.rs index ccd2f33..e14162f 100644 --- a/src/api/post/get_comment_list.rs +++ b/src/api/post/get_comment_list.rs @@ -8,8 +8,8 @@ use anyhow::Result; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] pub struct PostCommentEntry { - #[serde(rename = "Id")] pub id: usize, #[serde(rename = "Body")] pub content: String, @@ -19,7 +19,6 @@ pub struct PostCommentEntry { pub user_home_url: String, #[serde(rename = "FaceUrl")] pub avatar_url: String, - #[serde(rename = "Floor")] pub floor: usize, #[serde(rename = "DateAdded")] pub create_time: String, diff --git a/src/api/post/get_one.rs b/src/api/post/get_one.rs index 09a4e51..4fedee6 100644 --- a/src/api/post/get_one.rs +++ b/src/api/post/get_one.rs @@ -9,6 +9,7 @@ use serde_json::Value; // TODO: not elegant #[derive(Serialize, Deserialize, Debug)] +#[serde(rename_all = "camelCase")] pub struct PostEntry { pub id: usize, pub title: String, @@ -19,11 +20,8 @@ pub struct PostEntry { #[serde(rename = "dateUpdated")] pub modify_time: String, - #[serde(rename = "isDraft")] pub is_draft: bool, - #[serde(rename = "isPinned")] pub is_pinned: bool, - #[serde(rename = "isPublished")] pub is_published: bool, // WRN: diff --git a/src/api/user/info.rs b/src/api/user/info.rs index b931781..19df873 100644 --- a/src/api/user/info.rs +++ b/src/api/user/info.rs @@ -7,30 +7,21 @@ use anyhow::Result; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug, Clone)] +#[serde(rename_all = "PascalCase")] pub struct UserInfo { - #[serde(rename = "UserId")] pub user_id: String, #[serde(rename = "SpaceUserID")] pub space_user_id: usize, - #[serde(rename = "BlogId")] pub blog_id: usize, - #[serde(rename = "DisplayName")] pub display_name: String, - #[serde(rename = "Face")] pub face: String, - #[serde(rename = "Avatar")] pub avatar: String, - #[serde(rename = "Seniority")] pub seniority: String, - #[serde(rename = "BlogApp")] pub blog_app: String, - #[serde(rename = "FollowingCount")] pub following_count: usize, #[serde(rename = "FollowerCount")] pub followers_count: usize, - #[serde(rename = "IsVip")] pub is_vip: bool, - #[serde(rename = "Joined")] pub joined: String, }