Added activity_data activity-related models

This commit is contained in:
DylanCa 2023-12-29 02:50:24 +01:00
parent 52fd062a9c
commit 677adf9b5f
9 changed files with 169 additions and 0 deletions

View 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,
}

View 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,
}

View 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
}
}
}

View 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
}
}
}

View 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
}
}
}

View 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;

View 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
}
}
}

View 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
}
}
}

View 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,
}
}
}