-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathtypes.rs
More file actions
144 lines (137 loc) · 3.32 KB
/
types.rs
File metadata and controls
144 lines (137 loc) · 3.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
use longbridge_python_macros::PyObject;
use pyo3::prelude::*;
use crate::time::PyOffsetDateTimeWrapper;
/// Topic author
#[pyclass(skip_from_py_object)]
#[derive(Debug, PyObject, Clone)]
#[py(remote = "longbridge::content::TopicAuthor")]
pub(crate) struct TopicAuthor {
/// Member ID
member_id: String,
/// Display name
name: String,
/// Avatar URL
avatar: String,
}
/// Topic image
#[pyclass(skip_from_py_object)]
#[derive(Debug, PyObject, Clone)]
#[py(remote = "longbridge::content::TopicImage")]
pub(crate) struct TopicImage {
/// Original image URL
url: String,
/// Small thumbnail URL
sm: String,
/// Large image URL
lg: String,
}
/// My topic item (topic created by the current authenticated user)
#[pyclass(skip_from_py_object)]
#[derive(Debug, PyObject, Clone)]
#[py(remote = "longbridge::content::OwnedTopic")]
pub(crate) struct OwnedTopic {
/// Topic ID
id: String,
/// Title
title: String,
/// Plain text excerpt
description: String,
/// Markdown body
body: String,
/// Author
author: TopicAuthor,
/// Related stock tickers
#[py(array)]
tickers: Vec<String>,
/// Hashtag names
#[py(array)]
hashtags: Vec<String>,
/// Images
#[py(array)]
images: Vec<TopicImage>,
/// Likes count
likes_count: i32,
/// Comments count
comments_count: i32,
/// Views count
views_count: i32,
/// Shares count
shares_count: i32,
/// Content type: "article" or "post"
topic_type: String,
/// URL to the full topic page
detail_url: String,
/// Created time
created_at: PyOffsetDateTimeWrapper,
/// Updated time
updated_at: PyOffsetDateTimeWrapper,
}
/// Topic item
#[pyclass(skip_from_py_object)]
#[derive(Debug, PyObject, Clone)]
#[py(remote = "longbridge::content::TopicItem")]
pub(crate) struct TopicItem {
/// Topic ID
id: String,
/// Title
title: String,
/// Description
description: String,
/// URL
url: String,
/// Published time
published_at: PyOffsetDateTimeWrapper,
/// Comments count
comments_count: i32,
/// Likes count
likes_count: i32,
/// Shares count
shares_count: i32,
}
/// A reply on a topic
#[pyclass(skip_from_py_object)]
#[derive(Debug, PyObject, Clone)]
#[py(remote = "longbridge::content::TopicReply")]
pub(crate) struct TopicReply {
/// Reply ID
id: String,
/// Topic ID this reply belongs to
topic_id: String,
/// Reply body (plain text)
body: String,
/// ID of the parent reply ("0" means top-level)
reply_to_id: String,
/// Author info
author: TopicAuthor,
/// Attached images
#[py(array)]
images: Vec<TopicImage>,
/// Likes count
likes_count: i32,
/// Nested replies count
comments_count: i32,
/// Created time
created_at: PyOffsetDateTimeWrapper,
}
/// News item
#[pyclass(skip_from_py_object)]
#[derive(Debug, PyObject, Clone)]
#[py(remote = "longbridge::content::NewsItem")]
pub(crate) struct NewsItem {
/// News ID
id: String,
/// Title
title: String,
/// Description
description: String,
/// URL
url: String,
/// Published time
published_at: PyOffsetDateTimeWrapper,
/// Comments count
comments_count: i32,
/// Likes count
likes_count: i32,
/// Shares count
shares_count: i32,
}