Skip to content

Commit

Permalink
fix(http): List application emojis does not return a raw list (#2376)
Browse files Browse the repository at this point in the history
For some reason "List Application Emojis" returns a object with a single
`items` key which caused our use of `ListBody` to fail here.

Resolves: #2373
  • Loading branch information
Erk- authored Oct 5, 2024
1 parent c081973 commit 6584104
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
8 changes: 4 additions & 4 deletions twilight-http/src/request/application/emoji/list_emojis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ use std::future::IntoFuture;

use crate::{
request::{Request, TryIntoRequest},
response::{marker::ListBody, ResponseFuture},
response::ResponseFuture,
routing::Route,
Client, Error, Response,
};
use twilight_model::{
guild::Emoji,
application::EmojiList,
id::{marker::ApplicationMarker, Id},
};

Expand All @@ -27,9 +27,9 @@ impl<'a> ListApplicationEmojis<'a> {
}

impl IntoFuture for ListApplicationEmojis<'_> {
type Output = Result<Response<ListBody<Emoji>>, Error>;
type Output = Result<Response<EmojiList>, Error>;

type IntoFuture = ResponseFuture<ListBody<Emoji>>;
type IntoFuture = ResponseFuture<EmojiList>;

fn into_future(self) -> Self::IntoFuture {
let http = self.http;
Expand Down
10 changes: 10 additions & 0 deletions twilight-model/src/application/emoji.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use serde::{Deserialize, Serialize};

use crate::guild::Emoji;

/// List of application emojis
#[derive(Clone, Debug, Hash, PartialEq, Eq, Deserialize, Serialize)]
pub struct EmojiList {
/// List of application emojis
pub items: Vec<Emoji>,
}
3 changes: 3 additions & 0 deletions twilight-model/src/application/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
pub mod command;
mod emoji;
pub mod interaction;
pub mod monetization;

pub use emoji::EmojiList;

0 comments on commit 6584104

Please sign in to comment.