Added activity_data activity-related models
This commit is contained in:
parent
52fd062a9c
commit
677adf9b5f
9 changed files with 169 additions and 0 deletions
14
src/models/activity_data/activity_flag.rs
Normal file
14
src/models/activity_data/activity_flag.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
use serde::Serialize;
|
||||
|
||||
#[derive(Serialize, Debug)]
|
||||
pub enum ActivityFlag {
|
||||
Instance = 1,
|
||||
Join = 2,
|
||||
Spectate = 4,
|
||||
JoinRequest = 8,
|
||||
Sync = 16,
|
||||
Play = 32,
|
||||
PartyPrivacyFriends = 64,
|
||||
PartyPrivacyVoiceChannel = 128,
|
||||
Embedded = 256,
|
||||
}
|
||||
11
src/models/activity_data/activity_type.rs
Normal file
11
src/models/activity_data/activity_type.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
use serde::Serialize;
|
||||
|
||||
#[derive(Serialize, Debug)]
|
||||
pub enum ActivityType {
|
||||
GAME = 0,
|
||||
STREAMING = 1,
|
||||
LISTENING = 2,
|
||||
WATCHING = 3,
|
||||
CUSTOM = 4,
|
||||
COMPETING = 5,
|
||||
}
|
||||
31
src/models/activity_data/asset.rs
Normal file
31
src/models/activity_data/asset.rs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
use serde::Serialize;
|
||||
|
||||
#[derive(Serialize, Debug)]
|
||||
pub struct Asset {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
large_image: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
large_text: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
small_image: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
small_text: Option<String>,
|
||||
}
|
||||
|
||||
impl Asset {
|
||||
pub fn new(large_image: Option<String>,
|
||||
large_text: Option<String>,
|
||||
small_image: Option<String>,
|
||||
small_text: Option<String>,
|
||||
) -> Asset {
|
||||
Self {
|
||||
large_image,
|
||||
large_text,
|
||||
small_image,
|
||||
small_text
|
||||
}
|
||||
}
|
||||
}
|
||||
16
src/models/activity_data/button.rs
Normal file
16
src/models/activity_data/button.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
use serde::Serialize;
|
||||
|
||||
#[derive(Serialize, Debug)]
|
||||
pub struct Button {
|
||||
label: String,
|
||||
url: String,
|
||||
}
|
||||
|
||||
impl Button {
|
||||
pub fn new(label: String, url: String) -> Button {
|
||||
Self {
|
||||
label,
|
||||
url
|
||||
}
|
||||
}
|
||||
}
|
||||
24
src/models/activity_data/emoji.rs
Normal file
24
src/models/activity_data/emoji.rs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
use serde::Serialize;
|
||||
|
||||
#[derive(Serialize, Debug)]
|
||||
pub struct Emoji {
|
||||
name: String,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
id: Option<i64>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
animated: Option<bool>
|
||||
}
|
||||
|
||||
impl Emoji {
|
||||
pub fn new(name: String,
|
||||
id: Option<i64>,
|
||||
animated: Option<bool>) -> Emoji {
|
||||
Self {
|
||||
name,
|
||||
id,
|
||||
animated
|
||||
}
|
||||
}
|
||||
}
|
||||
8
src/models/activity_data/mod.rs
Normal file
8
src/models/activity_data/mod.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
pub mod activity_type;
|
||||
pub mod timestamp;
|
||||
pub mod emoji;
|
||||
pub mod party;
|
||||
pub mod asset;
|
||||
pub mod secret;
|
||||
pub mod activity_flag;
|
||||
pub mod button;
|
||||
19
src/models/activity_data/party.rs
Normal file
19
src/models/activity_data/party.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
use serde::Serialize;
|
||||
|
||||
#[derive(Serialize, Debug)]
|
||||
pub struct Party {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
id: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
size: Option<(i8, i8)>
|
||||
}
|
||||
|
||||
impl Party {
|
||||
pub fn new(id: Option<String>, size: Option<(i8, i8)>) -> Party {
|
||||
Self {
|
||||
id,
|
||||
size
|
||||
}
|
||||
}
|
||||
}
|
||||
26
src/models/activity_data/secret.rs
Normal file
26
src/models/activity_data/secret.rs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
use serde::Serialize;
|
||||
|
||||
#[derive(Serialize, Debug)]
|
||||
pub struct Secret {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
join: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
spectate: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
instanced_match: Option<String>
|
||||
}
|
||||
|
||||
impl Secret {
|
||||
pub fn new(join: Option<String>,
|
||||
spectate: Option<String>,
|
||||
instanced_match: Option<String>) -> Secret {
|
||||
Self {
|
||||
join,
|
||||
spectate,
|
||||
instanced_match
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
20
src/models/activity_data/timestamp.rs
Normal file
20
src/models/activity_data/timestamp.rs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
use serde::Serialize;
|
||||
|
||||
#[derive(Serialize, Debug)]
|
||||
pub struct Timestamp {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
start: Option<u128>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
end: Option<u128>,
|
||||
}
|
||||
|
||||
impl Timestamp {
|
||||
pub fn new(start: Option<u128>,
|
||||
end: Option<u128>) -> Timestamp {
|
||||
Self {
|
||||
start,
|
||||
end,
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue