Skip to content

Commit 1a42725

Browse files
committed
chore: move IngCommentEntry
1 parent 76c7548 commit 1a42725

File tree

6 files changed

+33
-27
lines changed

6 files changed

+33
-27
lines changed

src/api/ing/get_comment_list.rs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,33 @@
1-
use crate::api::ing::get_list::IngCommentEntry;
21
use crate::api::ing::Ing;
32
use crate::infra::http::{body_or_err, RequestBuilderExt};
43
use crate::infra::json;
54
use crate::infra::result::IntoResult;
65
use crate::openapi;
76
use anyhow::Result;
7+
use serde::{Deserialize, Serialize};
8+
9+
#[derive(Clone, Debug, Serialize, Deserialize)]
10+
pub struct IngCommentEntry {
11+
#[serde(rename = "Id")]
12+
pub id: usize,
13+
#[serde(rename = "Content")]
14+
pub content: String,
15+
#[serde(rename = "DateAdded")]
16+
pub create_time: String,
17+
#[serde(rename = "StatusId")]
18+
pub status_id: usize,
19+
#[serde(rename = "UserAlias")]
20+
pub user_alias: String,
21+
#[serde(rename = "UserDisplayName")]
22+
pub user_name: String,
23+
#[serde(rename = "UserIconUrl")]
24+
pub user_icon_url: String,
25+
#[serde(rename = "UserId")]
26+
pub user_id: usize,
27+
#[serde(rename = "UserGuid")]
28+
pub user_guid: String,
29+
}
30+
831

932
impl Ing {
1033
pub async fn get_comment_list(&self, ing_id: usize) -> Result<Vec<IngCommentEntry>> {

src/api/ing/get_list.rs

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use crate::openapi;
88
use anyhow::Result;
99
use serde::{Deserialize, Serialize};
1010
use std::ops::ControlFlow;
11+
use crate::api::ing::get_comment_list::IngCommentEntry;
1112

1213
#[derive(Clone, Debug, Serialize, Deserialize)]
1314
pub struct IngEntry {
@@ -39,28 +40,6 @@ pub struct IngEntry {
3940
pub icons: String,
4041
}
4142

42-
#[derive(Clone, Debug, Serialize, Deserialize)]
43-
pub struct IngCommentEntry {
44-
#[serde(rename = "Id")]
45-
pub id: usize,
46-
#[serde(rename = "Content")]
47-
pub content: String,
48-
#[serde(rename = "DateAdded")]
49-
pub create_time: String,
50-
#[serde(rename = "StatusId")]
51-
pub status_id: usize,
52-
#[serde(rename = "UserAlias")]
53-
pub user_alias: String,
54-
#[serde(rename = "UserDisplayName")]
55-
pub user_name: String,
56-
#[serde(rename = "UserIconUrl")]
57-
pub user_icon_url: String,
58-
#[serde(rename = "UserId")]
59-
pub user_id: usize,
60-
#[serde(rename = "UserGuid")]
61-
pub user_guid: String,
62-
}
63-
6443
type IngEntryWithComment = (IngEntry, Vec<IngCommentEntry>);
6544

6645
impl Ing {

src/display/colorful.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::api::ing::get_list::{IngCommentEntry, IngEntry};
1+
use crate::api::ing::get_list::{ IngEntry};
22
use crate::api::ing::{
33
fmt_content, get_ing_at_user_tag_text, ing_star_tag_to_text, rm_ing_at_user_tag, IngSendFrom,
44
};
@@ -15,6 +15,7 @@ use std::fmt::Display;
1515
use std::ops::Not;
1616
use std::path::PathBuf;
1717
use unicode_width::UnicodeWidthStr;
18+
use crate::api::ing::get_comment_list::IngCommentEntry;
1819

1920
pub fn login(cfg_path: &Result<PathBuf>) {
2021
match cfg_path {

src/display/json.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::api::ing::get_list::{IngCommentEntry, IngEntry};
1+
use crate::api::ing::get_list::{ IngEntry};
22
use crate::api::news::get_list::NewsEntry;
33
use crate::api::post::get_one::PostEntry;
44
use crate::api::user::info::UserInfo;
@@ -8,6 +8,7 @@ use anyhow::Result;
88
use serde::Serialize;
99
use serde_json::json;
1010
use std::path::PathBuf;
11+
use crate::api::ing::get_comment_list::IngCommentEntry;
1112

1213
pub fn login(cfg_path: &Result<PathBuf>) {
1314
let json = cfg_path.as_ref().map(|pb| json!({"cfg_path":pb}));

src/display/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
use crate::api::ing::get_list::{IngCommentEntry, IngEntry};
1+
use crate::api::ing::get_list::{IngEntry};
22
use crate::api::news::get_list::NewsEntry;
33
use crate::api::post::get_one::PostEntry;
44
use crate::api::user::info::UserInfo;
55
use crate::args::Style;
66
use anyhow::Result;
77
use std::path::PathBuf;
8+
use crate::api::ing::get_comment_list::IngCommentEntry;
89

910
mod colorful;
1011
mod json;

src/display/normal.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::api::ing::get_list::{IngCommentEntry, IngEntry};
1+
use crate::api::ing::get_list::{ IngEntry};
22
use crate::api::ing::{
33
fmt_content, get_ing_at_user_tag_text, ing_star_tag_to_text, rm_ing_at_user_tag, IngSendFrom,
44
};
@@ -15,6 +15,7 @@ use std::fmt::Display;
1515
use std::ops::Not;
1616
use std::path::PathBuf;
1717
use unicode_width::UnicodeWidthStr;
18+
use crate::api::ing::get_comment_list::IngCommentEntry;
1819

1920
pub fn login(cfg_path: &Result<PathBuf>) {
2021
match cfg_path {

0 commit comments

Comments
 (0)