Skip to content
This repository was archived by the owner on Jun 2, 2023. It is now read-only.

Commit 0347ae7

Browse files
committed
model: add emote model
1 parent aec1da8 commit 0347ae7

File tree

4 files changed

+36
-1
lines changed

4 files changed

+36
-1
lines changed

model/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ edition = "2021"
88
license = "ISC"
99
repository = "https://github.com/HarTexTeam/guilded-rs"
1010
rust-version = "1.57.0"
11-
version = "0.1.0-dev.14"
11+
version = "0.1.0-dev.15"
1212

1313
[dependencies]
1414
serde = { default-features = false, features = [ "derive", "std" ], version = "1.0.137" }

model/src/emote/mod.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//! The emote object.
2+
3+
use serde::{Deserialize, Serialize};
4+
5+
use crate::id::{marker::EmoteMarker, Id};
6+
7+
#[derive(Clone, Debug, Deserialize, Serialize)]
8+
#[serde(rename_all = "camelCase")]
9+
pub struct Emote {
10+
id: Id<EmoteMarker>,
11+
name: String,
12+
url: String,
13+
}
14+
15+
impl Emote {
16+
pub fn id(&self) -> Id<EmoteMarker> {
17+
self.id.clone()
18+
}
19+
20+
pub fn name(&self) -> &str {
21+
self.name.as_ref()
22+
}
23+
24+
pub fn url(&self) -> &str {
25+
self.url.as_ref()
26+
}
27+
}

model/src/id/marker.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ pub struct ChannelMarker;
3030
#[non_exhaustive]
3131
pub struct DocumentMarker;
3232

33+
/// A marker for emote IDs.
34+
///
35+
/// Emote IDs on Guilded are unique numerical IDs (for example, `123456`).
36+
#[derive(Clone, Copy, Debug)]
37+
#[non_exhaustive]
38+
pub struct EmoteMarker;
39+
3340
/// A marker for forum thread IDs.
3441
///
3542
/// Forum thread IDs on Guilded are unique numerical IDs (for example, `123456`).

model/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
pub mod channel;
66
pub mod datetime;
77
pub mod document;
8+
pub mod emote;
89
pub mod event;
910
pub mod forum;
1011
pub mod gateway;

0 commit comments

Comments
 (0)