Skip to main content

rust_okx/api/support/
responses.rs

1use serde::Deserialize;
2
3use crate::model::NumberString;
4
5/// A single announcement entry within [`AnnouncementsPage::details`].
6#[derive(Debug, Clone, Default, Deserialize)]
7#[serde(rename_all = "camelCase")]
8#[non_exhaustive]
9pub struct AnnouncementDetail {
10    /// Announcement title.
11    #[serde(default)]
12    pub title: String,
13    /// Announcement type identifier.
14    #[serde(default)]
15    pub ann_type: String,
16    /// Announcement URL.
17    #[serde(default)]
18    pub url: String,
19    /// Actual publish time (Unix milliseconds). May be delayed ~5 minutes.
20    #[serde(default)]
21    pub p_time: NumberString,
22    /// Display time shown on the announcement page (Unix milliseconds).
23    #[serde(default)]
24    pub business_p_time: NumberString,
25}
26
27/// Top-level element returned by
28/// [`get_announcements`](crate::api::support::Support::get_announcements).
29///
30/// The OKX `data` array always contains exactly one object of this type.
31/// The announcement list itself is in [`details`](AnnouncementsPage::details).
32///
33/// OKX docs: <https://www.okx.com/docs-v5/en/#rest-api-support-get-announcements>
34#[derive(Debug, Clone, Default, Deserialize)]
35#[serde(rename_all = "camelCase")]
36#[non_exhaustive]
37pub struct AnnouncementsPage {
38    /// Total number of pages available.
39    #[serde(default)]
40    pub total_page: String,
41    /// Announcement entries for the requested page.
42    #[serde(default)]
43    pub details: Vec<AnnouncementDetail>,
44}
45
46/// An announcement type returned by
47/// [`get_announcement_types`](crate::api::support::Support::get_announcement_types).
48///
49/// OKX docs: <https://www.okx.com/docs-v5/en/#rest-api-support-get-announcement-types>
50#[derive(Debug, Clone, Default, Deserialize)]
51#[serde(rename_all = "camelCase")]
52#[non_exhaustive]
53pub struct AnnouncementType {
54    /// Announcement type identifier (use as `ann_type` filter in
55    /// [`AnnouncementsRequest`](crate::api::support::AnnouncementsRequest)).
56    #[serde(default)]
57    pub ann_type: String,
58    /// Human-readable description of the announcement type.
59    #[serde(default)]
60    pub ann_type_desc: String,
61}