This repository has been archived by the owner on Jun 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8533a70
commit fe19dc8
Showing
8 changed files
with
86 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
//! # gwilight | ||
//! # guilded | ||
//! | ||
//! `gwilight` is a powerful, flexible, and scalable ecosystem of Rust libraries for the Guilded | ||
//! `guilded` is a powerful, flexible, and scalable ecosystem of Rust libraries for the Guilded | ||
//! API. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//! The member object. | ||
use crate::datetime::Timestamp; | ||
use crate::id::{marker::RoleMarker, Id}; | ||
use crate::user::User; | ||
|
||
/// Represents a server member. | ||
#[derive(Clone, Debug)] | ||
pub struct Member { | ||
user: User, | ||
role_ids: Vec<Id<RoleMarker>>, | ||
nickname: Option<String>, | ||
joined_at: Timestamp | ||
} | ||
|
||
impl Member { | ||
pub fn user(&self) -> User { | ||
self.user.clone() | ||
} | ||
|
||
pub fn role_ids(&self) -> Vec<Id<RoleMarker>> { | ||
self.role_ids.clone() | ||
} | ||
|
||
pub fn nickname(&self) -> Option<&str> { | ||
self.nickname.as_deref() | ||
} | ||
|
||
pub fn joined_at(&self) -> Timestamp { | ||
self.joined_at | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod member; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
//! The user object. | ||
use crate::datetime::Timestamp; | ||
use crate::id::{marker::UserMarker, Id}; | ||
|
||
#[derive(Clone, Debug)] | ||
pub struct User { | ||
id: Id<UserMarker>, | ||
r#type: UserType, | ||
name: String, | ||
created_at: Timestamp, | ||
} | ||
|
||
impl User { | ||
pub fn id(&self) -> Id<UserMarker> { | ||
self.id.clone() | ||
} | ||
|
||
pub fn r#type(&self) -> UserType { | ||
self.r#type.clone() | ||
} | ||
|
||
pub fn name(&self) -> &str { | ||
self.name.as_ref() | ||
} | ||
|
||
pub fn created_at(&self) -> Timestamp { | ||
self.created_at | ||
} | ||
} | ||
|
||
/// Represents the type of a user. | ||
#[derive(Clone, Debug)] | ||
pub enum UserType { | ||
Bot, | ||
User | ||
} |