Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(http)!: replace ListBody with Vec #2096

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion twilight-http/src/client/interaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use twilight_model::{
///
/// let interaction_client = client.interaction(application_id);
///
/// let commands = interaction_client.global_commands().await?.models().await?;
/// let commands = interaction_client.global_commands().await?.model().await?;
///
/// println!("there are {} global commands", commands.len());
/// # Ok(()) }
Expand Down
4 changes: 2 additions & 2 deletions twilight-http/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ impl Client {
/// .interaction(application_id)
/// .global_commands()
/// .await?
/// .models()
/// .model()
/// .await?;
///
/// println!("there are {} global commands", commands.len());
Expand Down Expand Up @@ -2412,7 +2412,7 @@ impl Client {
/// let client = Client::new("my token".to_owned());
///
/// let guild_id = Id::new(1);
/// let stickers = client.guild_stickers(guild_id).await?.models().await?;
/// let stickers = client.guild_stickers(guild_id).await?.model().await?;
///
/// println!("{}", stickers.len());
/// # Ok(()) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
client::Client,
error::Error,
request::{Request, TryIntoRequest},
response::{marker::ListBody, Response, ResponseFuture},
response::{Response, ResponseFuture},
routing::Route,
};
use std::future::IntoFuture;
Expand Down Expand Up @@ -39,9 +39,9 @@ impl<'a> GetGlobalCommands<'a> {
}

impl IntoFuture for GetGlobalCommands<'_> {
type Output = Result<Response<ListBody<Command>>, Error>;
type Output = Result<Response<Vec<Command>>, Error>;

type IntoFuture = ResponseFuture<ListBody<Command>>;
type IntoFuture = ResponseFuture<Vec<Command>>;

fn into_future(self) -> Self::IntoFuture {
let http = self.http;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
client::Client,
error::Error,
request::{Request, TryIntoRequest},
response::{marker::ListBody, Response, ResponseFuture},
response::{Response, ResponseFuture},
routing::Route,
};
use std::future::IntoFuture;
Expand Down Expand Up @@ -37,9 +37,9 @@ impl<'a> GetGuildCommandPermissions<'a> {
}

impl IntoFuture for GetGuildCommandPermissions<'_> {
type Output = Result<Response<ListBody<GuildCommandPermissions>>, Error>;
type Output = Result<Response<Vec<GuildCommandPermissions>>, Error>;

type IntoFuture = ResponseFuture<ListBody<GuildCommandPermissions>>;
type IntoFuture = ResponseFuture<Vec<GuildCommandPermissions>>;

fn into_future(self) -> Self::IntoFuture {
let http = self.http;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
client::Client,
error::Error,
request::{Request, TryIntoRequest},
response::{marker::ListBody, Response, ResponseFuture},
response::{Response, ResponseFuture},
routing::Route,
};
use std::future::IntoFuture;
Expand Down Expand Up @@ -48,9 +48,9 @@ impl<'a> GetGuildCommands<'a> {
}

impl IntoFuture for GetGuildCommands<'_> {
type Output = Result<Response<ListBody<Command>>, Error>;
type Output = Result<Response<Vec<Command>>, Error>;

type IntoFuture = ResponseFuture<ListBody<Command>>;
type IntoFuture = ResponseFuture<Vec<Command>>;

fn into_future(self) -> Self::IntoFuture {
let http = self.http;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
client::Client,
error::Error,
request::{Request, TryIntoRequest},
response::{marker::ListBody, Response, ResponseFuture},
response::{Response, ResponseFuture},
routing::Route,
};
use std::future::IntoFuture;
Expand Down Expand Up @@ -43,9 +43,9 @@ impl<'a> SetGlobalCommands<'a> {
}

impl IntoFuture for SetGlobalCommands<'_> {
type Output = Result<Response<ListBody<Command>>, Error>;
type Output = Result<Response<Vec<Command>>, Error>;

type IntoFuture = ResponseFuture<ListBody<Command>>;
type IntoFuture = ResponseFuture<Vec<Command>>;

fn into_future(self) -> Self::IntoFuture {
let http = self.http;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
client::Client,
error::Error,
request::{Request, TryIntoRequest},
response::{marker::ListBody, Response, ResponseFuture},
response::{Response, ResponseFuture},
routing::Route,
};
use std::future::IntoFuture;
Expand Down Expand Up @@ -49,9 +49,9 @@ impl<'a> SetGuildCommands<'a> {
}

impl IntoFuture for SetGuildCommands<'_> {
type Output = Result<Response<ListBody<Command>>, Error>;
type Output = Result<Response<Vec<Command>>, Error>;

type IntoFuture = ResponseFuture<ListBody<Command>>;
type IntoFuture = ResponseFuture<Vec<Command>>;

fn into_future(self) -> Self::IntoFuture {
let http = self.http;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
client::Client,
error::Error,
request::{Request, TryIntoRequest},
response::{marker::ListBody, Response, ResponseFuture},
response::{Response, ResponseFuture},
routing::Route,
};
use serde::Serialize;
Expand Down Expand Up @@ -64,9 +64,9 @@ impl<'a> UpdateCommandPermissions<'a> {
}

impl IntoFuture for UpdateCommandPermissions<'_> {
type Output = Result<Response<ListBody<CommandPermission>>, Error>;
type Output = Result<Response<Vec<CommandPermission>>, Error>;

type IntoFuture = ResponseFuture<ListBody<CommandPermission>>;
type IntoFuture = ResponseFuture<Vec<CommandPermission>>;

fn into_future(self) -> Self::IntoFuture {
let http = self.http;
Expand Down
6 changes: 3 additions & 3 deletions twilight-http/src/request/channel/get_pins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
client::Client,
error::Error,
request::{Request, TryIntoRequest},
response::{marker::ListBody, Response, ResponseFuture},
response::{Response, ResponseFuture},
routing::Route,
};
use std::future::IntoFuture;
Expand All @@ -25,9 +25,9 @@ impl<'a> GetPins<'a> {
}

impl IntoFuture for GetPins<'_> {
type Output = Result<Response<ListBody<Message>>, Error>;
type Output = Result<Response<Vec<Message>>, Error>;

type IntoFuture = ResponseFuture<ListBody<Message>>;
type IntoFuture = ResponseFuture<Vec<Message>>;

fn into_future(self) -> Self::IntoFuture {
let http = self.http;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
client::Client,
error::Error,
request::{Request, TryIntoRequest},
response::{marker::ListBody, Response, ResponseFuture},
response::{Response, ResponseFuture},
routing::Route,
};
use std::future::IntoFuture;
Expand Down Expand Up @@ -30,9 +30,9 @@ impl<'a> GetChannelInvites<'a> {
}

impl IntoFuture for GetChannelInvites<'_> {
type Output = Result<Response<ListBody<Invite>>, Error>;
type Output = Result<Response<Vec<Invite>>, Error>;

type IntoFuture = ResponseFuture<ListBody<Invite>>;
type IntoFuture = ResponseFuture<Vec<Invite>>;

fn into_future(self) -> Self::IntoFuture {
let http = self.http;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{
client::Client,
error::Error,
request::{Request, TryIntoRequest},
response::{marker::ListBody, Response, ResponseFuture},
response::{Response, ResponseFuture},
routing::Route,
};
use std::future::IntoFuture;
Expand Down Expand Up @@ -127,9 +127,9 @@ impl<'a> GetChannelMessages<'a> {
}

impl IntoFuture for GetChannelMessages<'_> {
type Output = Result<Response<ListBody<Message>>, Error>;
type Output = Result<Response<Vec<Message>>, Error>;

type IntoFuture = ResponseFuture<ListBody<Message>>;
type IntoFuture = ResponseFuture<Vec<Message>>;

fn into_future(self) -> Self::IntoFuture {
let http = self.http;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
client::Client,
error::Error,
request::{Request, TryIntoRequest},
response::{marker::ListBody, Response, ResponseFuture},
response::{Response, ResponseFuture},
routing::Route,
};
use std::future::IntoFuture;
Expand Down Expand Up @@ -80,9 +80,9 @@ impl<'a> GetChannelMessagesConfigured<'a> {
}

impl IntoFuture for GetChannelMessagesConfigured<'_> {
type Output = Result<Response<ListBody<Message>>, Error>;
type Output = Result<Response<Vec<Message>>, Error>;

type IntoFuture = ResponseFuture<ListBody<Message>>;
type IntoFuture = ResponseFuture<Vec<Message>>;

fn into_future(self) -> Self::IntoFuture {
let http = self.http;
Expand Down
6 changes: 3 additions & 3 deletions twilight-http/src/request/channel/reaction/get_reactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{
client::Client,
error::Error,
request::{Request, TryIntoRequest},
response::{marker::ListBody, Response, ResponseFuture},
response::{Response, ResponseFuture},
routing::Route,
};
use std::future::IntoFuture;
Expand Down Expand Up @@ -88,9 +88,9 @@ impl<'a> GetReactions<'a> {
}

impl IntoFuture for GetReactions<'_> {
type Output = Result<Response<ListBody<User>>, Error>;
type Output = Result<Response<Vec<User>>, Error>;

type IntoFuture = ResponseFuture<ListBody<User>>;
type IntoFuture = ResponseFuture<Vec<User>>;

fn into_future(self) -> Self::IntoFuture {
let http = self.http;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
client::Client,
error::Error,
request::{Request, TryIntoRequest},
response::{marker::ListBody, Response, ResponseFuture},
response::{Response, ResponseFuture},
routing::Route,
};
use std::future::IntoFuture;
Expand Down Expand Up @@ -85,9 +85,9 @@ impl<'a> GetThreadMembers<'a> {
}

impl IntoFuture for GetThreadMembers<'_> {
type Output = Result<Response<ListBody<ThreadMember>>, Error>;
type Output = Result<Response<Vec<ThreadMember>>, Error>;

type IntoFuture = ResponseFuture<ListBody<ThreadMember>>;
type IntoFuture = ResponseFuture<Vec<ThreadMember>>;

fn into_future(self) -> Self::IntoFuture {
let http = self.http;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
client::Client,
error::Error,
request::{Request, TryIntoRequest},
response::{marker::ListBody, Response, ResponseFuture},
response::{Response, ResponseFuture},
routing::Route,
};
use std::future::IntoFuture;
Expand All @@ -25,9 +25,9 @@ impl<'a> GetChannelWebhooks<'a> {
}

impl IntoFuture for GetChannelWebhooks<'_> {
type Output = Result<Response<ListBody<Webhook>>, Error>;
type Output = Result<Response<Vec<Webhook>>, Error>;

type IntoFuture = ResponseFuture<ListBody<Webhook>>;
type IntoFuture = ResponseFuture<Vec<Webhook>>;

fn into_future(self) -> Self::IntoFuture {
let http = self.http;
Expand Down
6 changes: 3 additions & 3 deletions twilight-http/src/request/get_voice_regions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
client::Client,
error::Error,
request::{Request, TryIntoRequest},
response::{marker::ListBody, Response, ResponseFuture},
response::{Response, ResponseFuture},
routing::Route,
};
use std::future::IntoFuture;
Expand All @@ -21,9 +21,9 @@ impl<'a> GetVoiceRegions<'a> {
}

impl IntoFuture for GetVoiceRegions<'_> {
type Output = Result<Response<ListBody<VoiceRegion>>, Error>;
type Output = Result<Response<Vec<VoiceRegion>>, Error>;

type IntoFuture = ResponseFuture<ListBody<VoiceRegion>>;
type IntoFuture = ResponseFuture<Vec<VoiceRegion>>;

fn into_future(self) -> Self::IntoFuture {
let http = self.http;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
client::Client,
error::Error,
request::{Request, TryIntoRequest},
response::{marker::ListBody, Response, ResponseFuture},
response::{Response, ResponseFuture},
routing::Route,
};
use std::future::IntoFuture;
Expand All @@ -29,9 +29,9 @@ impl<'a> GetGuildAutoModerationRules<'a> {
}

impl IntoFuture for GetGuildAutoModerationRules<'_> {
type Output = Result<Response<ListBody<AutoModerationRule>>, Error>;
type Output = Result<Response<Vec<AutoModerationRule>>, Error>;

type IntoFuture = ResponseFuture<ListBody<AutoModerationRule>>;
type IntoFuture = ResponseFuture<Vec<AutoModerationRule>>;

fn into_future(self) -> Self::IntoFuture {
let http = self.http;
Expand Down
8 changes: 4 additions & 4 deletions twilight-http/src/request/guild/ban/get_bans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
client::Client,
error::Error,
request::{Request, TryIntoRequest},
response::{marker::ListBody, Response, ResponseFuture},
response::{Response, ResponseFuture},
routing::Route,
};
use std::future::IntoFuture;
Expand Down Expand Up @@ -42,7 +42,7 @@ struct GetBansFields {
/// let user_id = Id::new(2);
///
/// let response = client.bans(guild_id).after(user_id).limit(25).await?;
/// let bans = response.models().await?;
/// let bans = response.model().await?;
///
/// for ban in bans {
/// println!("{} was banned for: {:?}", ban.user.name, ban.reason);
Expand Down Expand Up @@ -122,9 +122,9 @@ impl<'a> GetBans<'a> {
}

impl IntoFuture for GetBans<'_> {
type Output = Result<Response<ListBody<Ban>>, Error>;
type Output = Result<Response<Vec<Ban>>, Error>;

type IntoFuture = ResponseFuture<ListBody<Ban>>;
type IntoFuture = ResponseFuture<Vec<Ban>>;

fn into_future(self) -> Self::IntoFuture {
let http = self.http;
Expand Down
6 changes: 3 additions & 3 deletions twilight-http/src/request/guild/emoji/get_emojis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
client::Client,
error::Error,
request::{Request, TryIntoRequest},
response::{marker::ListBody, Response, ResponseFuture},
response::{Response, ResponseFuture},
routing::Route,
};
use std::future::IntoFuture;
Expand Down Expand Up @@ -43,9 +43,9 @@ impl<'a> GetEmojis<'a> {
}

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

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

fn into_future(self) -> Self::IntoFuture {
let http = self.http;
Expand Down
Loading
Loading