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

Commit

Permalink
model: add emote model
Browse files Browse the repository at this point in the history
  • Loading branch information
HTGAzureX1212 committed Jun 24, 2022
1 parent aec1da8 commit 0347ae7
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion model/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2021"
license = "ISC"
repository = "https://github.com/HarTexTeam/guilded-rs"
rust-version = "1.57.0"
version = "0.1.0-dev.14"
version = "0.1.0-dev.15"

[dependencies]
serde = { default-features = false, features = [ "derive", "std" ], version = "1.0.137" }
Expand Down
27 changes: 27 additions & 0 deletions model/src/emote/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//! The emote object.
use serde::{Deserialize, Serialize};

use crate::id::{marker::EmoteMarker, Id};

#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Emote {
id: Id<EmoteMarker>,
name: String,
url: String,
}

impl Emote {
pub fn id(&self) -> Id<EmoteMarker> {
self.id.clone()
}

pub fn name(&self) -> &str {
self.name.as_ref()
}

pub fn url(&self) -> &str {
self.url.as_ref()
}
}
7 changes: 7 additions & 0 deletions model/src/id/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ pub struct ChannelMarker;
#[non_exhaustive]
pub struct DocumentMarker;

/// A marker for emote IDs.
///
/// Emote IDs on Guilded are unique numerical IDs (for example, `123456`).
#[derive(Clone, Copy, Debug)]
#[non_exhaustive]
pub struct EmoteMarker;

/// A marker for forum thread IDs.
///
/// Forum thread IDs on Guilded are unique numerical IDs (for example, `123456`).
Expand Down
1 change: 1 addition & 0 deletions model/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
pub mod channel;
pub mod datetime;
pub mod document;
pub mod emote;
pub mod event;
pub mod forum;
pub mod gateway;
Expand Down

0 comments on commit 0347ae7

Please sign in to comment.