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

Commit

Permalink
fix stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
HTGAzureX1212 committed Jun 20, 2022
1 parent df32d65 commit 14ea574
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 26 deletions.
87 changes: 63 additions & 24 deletions http/src/route.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,7 @@ impl<'a> Route<'a> {
impl Display for Route<'_> {
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
match self {
Self::ChannelCreate => {
f.write_str("channels")
}
Self::ChannelCreate => f.write_str("channels"),
Self::ChannelDelete { channel_id }
| Self::ChannelRead { channel_id }
| Self::ChannelUpdate { channel_id } => {
Expand Down Expand Up @@ -291,12 +289,12 @@ impl Display for Route<'_> {

if let Some(after) = after {
f.write_str("after=")?;
Display::fmt(after, f)?;
Display::fmt(&after.display(), f)?;
}

if let Some(before) = before {
f.write_str("&before=")?;
Display::fmt(before, f)?;
Display::fmt(&before.display(), f)?;
}

if let Some(include_private) = include_private {
Expand All @@ -311,17 +309,24 @@ impl Display for Route<'_> {

Ok(())
}
Self::ContentReactionCreate { channel_id, content_id, emote_id }
| Self::ContentReactionDelete { channel_id, content_id, emote_id} => {
Self::ContentReactionCreate {
channel_id,
content_id,
emote_id,
}
| Self::ContentReactionDelete {
channel_id,
content_id,
emote_id,
} => {
f.write_str("channels/")?;
Display::fmt(channel_id, f)?;
f.write_str("/content/")?;
Display::fmt(content_id, f)?;
f.write_str("/emotes/")?;
Display::fmt(emote_id, f)
}
Self::DocCreate { channel_id }
| Self::DocReadMany { channel_id } => {
Self::DocCreate { channel_id } | Self::DocReadMany { channel_id } => {
f.write_str("channels/")?;
Display::fmt(channel_id, f)?;
f.write_str("/docs")
Expand All @@ -346,23 +351,37 @@ impl Display for Route<'_> {
f.write_str("/members/")?;
Display::fmt(user_id, f)
}
Self::ListItemCreate { channel_id }
| Self::ListItemReadMany { channel_id } => {
Self::ListItemCreate { channel_id } | Self::ListItemReadMany { channel_id } => {
f.write_str("channels/")?;
Display::fmt(channel_id, f)?;
f.write_str("/items")
}
Self::ListItemCompleteCreate { channel_id, list_item_id }
| Self::ListItemCompleteDelete { channel_id, list_item_id } => {
Self::ListItemCompleteCreate {
channel_id,
list_item_id,
}
| Self::ListItemCompleteDelete {
channel_id,
list_item_id,
} => {
f.write_str("channels/")?;
Display::fmt(channel_id, f)?;
f.write_str("/items/")?;
Display::fmt(list_item_id, f)?;
f.write_str("/complete")
}
Self::ListItemDelete { channel_id, list_item_id }
| Self::ListItemRead { channel_id, list_item_id }
| Self::ListItemUpdate { channel_id, list_item_id } => {
Self::ListItemDelete {
channel_id,
list_item_id,
}
| Self::ListItemRead {
channel_id,
list_item_id,
}
| Self::ListItemUpdate {
channel_id,
list_item_id,
} => {
f.write_str("channels/")?;
Display::fmt(channel_id, f)?;
f.write_str("/items/")?;
Expand All @@ -376,16 +395,28 @@ impl Display for Route<'_> {
Display::fmt(user_id, f)?;
f.write_str("/nickname")
}
Self::MemberSocialLinkRead { server_id, user_id, r#type } => {
Self::MemberSocialLinkRead {
server_id,
user_id,
r#type,
} => {
f.write_str("servers/")?;
Display::fmt(server_id, f)?;
f.write_str("/members/")?;
Display::fmt(user_id, f)?;
f.write_str("/social-links/")?;
Display::fmt(r#type, f)
}
Self::RoleMembershipCreate { role_id, server_id, user_id}
| Self::RoleMembershipDelete { role_id, server_id, user_id } => {
Self::RoleMembershipCreate {
role_id,
server_id,
user_id,
}
| Self::RoleMembershipDelete {
role_id,
server_id,
user_id,
} => {
f.write_str("servers/")?;
Display::fmt(server_id, f)?;
f.write_str("/members/")?;
Expand Down Expand Up @@ -443,15 +474,23 @@ impl Display for Route<'_> {
Display::fmt(user_id, f)?;
f.write_str("/xp")
}
Self::WebhookCreate { server_id }
| Self::WebhookReadMany { server_id } => {
Self::WebhookCreate { server_id } | Self::WebhookReadMany { server_id } => {
f.write_str("servers/")?;
Display::fmt(server_id, f)?;
f.write_str("/webhooks")
}
Self::WebhookDelete { server_id, webhook_id }
| Self::WebhookRead { server_id, webhook_id }
| Self::WebhookUpdate { server_id, webhook_id} => {
Self::WebhookDelete {
server_id,
webhook_id,
}
| Self::WebhookRead {
server_id,
webhook_id,
}
| Self::WebhookUpdate {
server_id,
webhook_id,
} => {
f.write_str("servers/")?;
Display::fmt(server_id, f)?;
f.write_str("/webhooks/")?;
Expand Down
2 changes: 1 addition & 1 deletion model/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ version = "0.1.0-dev"

[dependencies]
serde = { default-features = false, features = [ "derive", "std" ], version = "1.0.137" }
time = { default-features = false, features = [ "parsing", "std" ], version = "0.3.5" }
time = { default-features = false, features = [ "parsing", "std" ], version = "0.3.10" }
uuid = { default-features = false, features = [ "v5" ], version = "0.8.2" }
2 changes: 1 addition & 1 deletion model/src/user/partial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ impl PartialUser {
}

pub fn r#type(&self) -> UserType {
self.r#type.clone()
self.r#type
}
}

0 comments on commit 14ea574

Please sign in to comment.