Skip to content

Commit

Permalink
Revert "redefine serde serialize"
Browse files Browse the repository at this point in the history
fix: macos11,12,13, unbuntu20.04,22.04, windows2019,2022,linux musl can't compile.
This reverts commit 2fe9a10.
  • Loading branch information
RocsSun committed Dec 28, 2023
1 parent bd81a41 commit b8870ec
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/api/fav/get_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ 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<String>,
#[serde(rename = "DateAdded")]
pub create_time: String,
Expand Down
8 changes: 7 additions & 1 deletion src/api/ing/get_comment_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,24 @@ 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,
}

Expand Down
11 changes: 10 additions & 1 deletion src/api/ing/get_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,30 @@ 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,
Expand Down
8 changes: 7 additions & 1 deletion src/api/news/get_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,22 @@ 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<String>,
#[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,
Expand Down
3 changes: 2 additions & 1 deletion src/api/post/get_comment_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -19,6 +19,7 @@ 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,
Expand Down
4 changes: 3 additions & 1 deletion src/api/post/get_one.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use serde_json::Value;

// TODO: not elegant
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct PostEntry {
pub id: usize,
pub title: String,
Expand All @@ -20,8 +19,11 @@ 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:
Expand Down
11 changes: 10 additions & 1 deletion src/api/user/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,30 @@ 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,
}

Expand Down

0 comments on commit b8870ec

Please sign in to comment.