titanium_http/
routes.rs

1//! Discord API route types and responses.
2
3use serde::Deserialize;
4use titanium_model::Snowflake;
5
6/// Response from GET /gateway/bot.
7#[derive(Debug, Clone, Deserialize)]
8pub struct GatewayBotResponse {
9    /// Gateway WebSocket URL.
10    pub url: String,
11
12    /// Recommended number of shards.
13    pub shards: u16,
14
15    /// Session start limit information.
16    pub session_start_limit: SessionStartLimit,
17}
18
19/// Session start limit from /gateway/bot.
20#[derive(Debug, Clone, Deserialize)]
21pub struct SessionStartLimit {
22    /// Total number of session starts allowed.
23    pub total: u32,
24
25    /// Remaining session starts.
26    pub remaining: u32,
27
28    /// Milliseconds until the limit resets.
29    pub reset_after: u64,
30
31    /// Maximum number of concurrent identify operations.
32    pub max_concurrency: u32,
33}
34
35/// Response from GET /users/@me.
36#[derive(Debug, Clone, Deserialize)]
37pub struct CurrentUser {
38    pub id: Snowflake,
39    pub username: String,
40    pub discriminator: String,
41    #[serde(default)]
42    pub avatar: Option<String>,
43    #[serde(default)]
44    pub bot: bool,
45    #[serde(default)]
46    pub verified: bool,
47    #[serde(default)]
48    pub email: Option<String>,
49    #[serde(default)]
50    pub global_name: Option<String>,
51    #[serde(default)]
52    pub system: bool,
53    #[serde(default)]
54    pub mfa_enabled: Option<bool>,
55    #[serde(default)]
56    pub banner: Option<String>,
57    #[serde(default)]
58    pub accent_color: Option<u32>,
59    #[serde(default)]
60    pub locale: Option<String>,
61    #[serde(default)]
62    pub flags: Option<u64>,
63    #[serde(default)]
64    pub premium_type: Option<u8>,
65    #[serde(default)]
66    pub public_flags: Option<u64>,
67}
68
69/// Response from GET /applications/@me.
70#[derive(Debug, Clone, Deserialize)]
71pub struct CurrentApplication {
72    pub id: Snowflake,
73    pub name: String,
74    #[serde(default)]
75    pub icon: Option<String>,
76    #[serde(default)]
77    pub description: String,
78    #[serde(default)]
79    pub bot_public: bool,
80    #[serde(default)]
81    pub bot_require_code_grant: bool,
82    #[serde(default)]
83    pub flags: Option<u64>,
84}