Struct rive::http::Client

source ·
pub struct Client { /* private fields */ }

Implementations§

source§

impl Client

source

pub async fn create_account( &self, payload: CreateAccountPayload ) -> impl Future<Output = Result<(), Error>>

Create a new account.

source

pub async fn resend_verification( &self, payload: ResendVerificationPayload ) -> impl Future<Output = Result<(), Error>>

Resend account creation verification email.

source

pub async fn confirm_account_deletion( &self, payload: ConfirmAccountDeletionPayload ) -> impl Future<Output = Result<(), Error>>

Schedule an account for deletion by confirming the received token.

source

pub async fn delete_account(&self) -> impl Future<Output = Result<(), Error>>

Request to have an account deleted.

source

pub async fn fetch_account( &self ) -> impl Future<Output = Result<AccountInfo, Error>>

Fetch account information from the current session.

source

pub async fn disable_account(&self) -> impl Future<Output = Result<(), Error>>

Disable an account.

source

pub async fn change_password( &self, payload: ChangePasswordPayload ) -> impl Future<Output = Result<(), Error>>

Change the current account password.

source

pub async fn change_email( &self, payload: ChangeEmailPayload ) -> impl Future<Output = Result<(), Error>>

Change the associated account email.

source

pub async fn verify_email( &self, code: impl Into<String> ) -> impl Future<Output = Result<EmailVerification, Error>>

Change the associated account email.

source

pub async fn send_password_reset( &self, payload: SendPasswordResetPayload ) -> impl Future<Output = Result<(), Error>>

Send an email to reset account password.

source

pub async fn password_reset( &self, payload: PasswordResetPayload ) -> impl Future<Output = Result<(), Error>>

Confirm password reset and change the password.

source§

impl Client

source

pub async fn create_mfa_ticket( &self, payload: MFAData ) -> impl Future<Output = Result<MFATicket, Error>>

Create a new MFA ticket or validate an existing one.

source

pub async fn fetch_mfa_status( &self ) -> impl Future<Output = Result<MFAStatus, Error>>

Fetch MFA status of an account.

source

pub async fn fetch_recovery_codes( &self ) -> impl Future<Output = Result<Vec<String, Global>, Error>>

Fetch recovery codes for an account.

source

pub async fn generate_recovery_codes( &self ) -> impl Future<Output = Result<Vec<String, Global>, Error>>

Re-generate recovery codes for an account.

source

pub async fn get_mfa_methods( &self ) -> impl Future<Output = Result<Vec<MFAMethod, Global>, Error>>

Fetch available MFA methods.

source

pub async fn enable_totp_2fa( &self, payload: MFAData ) -> impl Future<Output = Result<(), Error>>

Enable TOTP 2FA for an account.

source

pub async fn generate_totp_secret( &self ) -> impl Future<Output = Result<TOTPSecret, Error>>

Generate a new secret for TOTP.

source

pub async fn disable_totp_2fa(&self) -> impl Future<Output = Result<(), Error>>

Disable TOTP 2FA for an account.

source§

impl Client

source

pub async fn check_onboarding_status( &self ) -> impl Future<Output = Result<OnboardingStatus, Error>>

This will tell you whether the current account requires onboarding or whether you can continue to send requests as usual. You may skip calling this if you’re restoring an existing session.

source

pub async fn complete_onboarding( &self, payload: CompleteOnboardingPayload ) -> impl Future<Output = Result<(), Error>>

This sets a new username, completes onboarding and allows a user to start using Revolt.

source§

impl Client

source

pub async fn login( &self, payload: LoginPayload ) -> impl Future<Output = Result<LoginResponse, Error>>

Login to an account.

source

pub async fn logout(&self) -> impl Future<Output = Result<(), Error>>

Delete current session.

source

pub async fn fetch_sessions( &self ) -> impl Future<Output = Result<Vec<SessionInfo, Global>, Error>>

Fetch all sessions associated with this account.

source

pub async fn delete_all_sessions( &self, payload: DeleteAllSessionsPayload ) -> impl Future<Output = Result<(), Error>>

Delete all active sessions, optionally including current one.

source

pub async fn revoke_session( &self, id: impl Into<String> ) -> impl Future<Output = Result<(), Error>>

Delete a specific active session.

source

pub async fn edit_session( &self, id: impl Into<String>, payload: EditSessionPayload ) -> impl Future<Output = Result<SessionInfo, Error>>

Edit specific session information.

source§

impl Client

source

pub async fn create_bot( &self, payload: CreateBotPayload ) -> impl Future<Output = Result<Bot, Error>>

Create a new Revolt bot.

source

pub async fn fetch_public_bot( &self, id: impl Into<String> ) -> impl Future<Output = Result<PublicBot, Error>>

Fetch details of a public (or owned) bot by its id.

source

pub async fn invite_bot( &self, bot_id: impl Into<String>, payload: InviteBotPayload ) -> impl Future<Output = Result<(), Error>>

Invite a bot to a server or group by its id.

source

pub async fn fetch_bot( &self, id: impl Into<String> ) -> impl Future<Output = Result<OwnedBot, Error>>

Fetch details of a bot you own by its id.

source

pub async fn delete_bot( &self, id: impl Into<String> ) -> impl Future<Output = Result<(), Error>>

Delete a bot by its id.

source

pub async fn edit_bot( &self, id: impl Into<String>, payload: EditBotPayload ) -> impl Future<Output = Result<Bot, Error>>

Edit bot details by its id.

source

pub async fn fetch_owned_bots( &self ) -> impl Future<Output = Result<OwnedBots, Error>>

Fetch all of the bots that you have control over.

source§

impl Client

source

pub async fn fetch_channel( &self, id: impl Into<String> ) -> impl Future<Output = Result<Channel, Error>>

Fetch channel by its ID.

source

pub async fn close_channel( &self, id: impl Into<String> ) -> impl Future<Output = Result<(), Error>>

Deletes a server channel, leaves a group or closes a group.

source

pub async fn edit_channel( &self, id: impl Into<String>, payload: EditChannelPayload ) -> impl Future<Output = Result<Channel, Error>>

Edit a channel object by its id.

source§

impl Client

source

pub async fn create_invite( &self, id: impl Into<String> ) -> impl Future<Output = Result<PartialInvite, Error>>

Creates an invite to this channel.

Channel must be a [Channel::TextChannel].

source§

impl Client

source

pub async fn set_role_channel_permissions( &self, channel_id: impl Into<String>, role_id: impl Into<String>, payload: SetRolePermissionPayload ) -> impl Future<Output = Result<Channel, Error>>

Sets permissions for the specified role in this channel.

Channel must be a Channel::TextChannel or Channel::VoiceChannel.

source

pub async fn set_default_channel_permissions( &self, channel_id: impl Into<String>, payload: SetDefaultPermissionPayload ) -> impl Future<Output = Result<Channel, Error>>

Sets permissions for the specified role in this channel.

Channel must be a Channel::Group, Channel::TextChannel or Channel::VoiceChannel.

source§

impl Client

source

pub async fn fetch_group_members( &self, id: impl Into<String> ) -> impl Future<Output = Result<Vec<User, Global>, Error>>

Retrieves all users who are part of this group.

source

pub async fn create_group( &self, payload: CreateGroupPayload ) -> impl Future<Output = Result<Channel, Error>>

Create a new group channel.

source

pub async fn add_member_to_group( &self, group_id: impl Into<String>, member_id: impl Into<String> ) -> impl Future<Output = Result<(), Error>>

Adds another user to the group.

source

pub async fn remove_member_from_group( &self, group_id: impl Into<String>, member_id: impl Into<String> ) -> impl Future<Output = Result<(), Error>>

Removes a user from the group.

source§

impl Client

source

pub async fn add_reaction_to_message( &self, channel_id: impl Into<String>, message_id: impl Into<String>, emoji: impl Into<String> ) -> impl Future<Output = Result<(), Error>>

React to a given message.

source

pub async fn remove_reaction_to_message( &self, channel_id: impl Into<String>, message_id: impl Into<String>, emoji: impl Into<String>, payload: RemoveReactionToMessagePayload ) -> impl Future<Output = Result<(), Error>>

Remove your own, someone else’s or all of a given reaction.

Requires [Permission::ManageMessages] if changing others’ reactions.

source

pub async fn remove_all_reactions_from_message( &self, channel_id: impl Into<String>, message_id: impl Into<String> ) -> impl Future<Output = Result<(), Error>>

Remove your own, someone else’s or all of a given reaction.

Requires [Permission::ManageMessages].

source§

impl Client

source

pub async fn acknowledge_message( &self, channel_id: impl Into<String>, message_id: impl Into<String> ) -> impl Future<Output = Result<(), Error>>

Lets the server and all other clients know that we’ve seen this message id in this channel.

source

pub async fn fetch_messages( &self, channel_id: impl Into<String>, payload: FetchMessagesPayload ) -> impl Future<Output = Result<BulkMessageResponse, Error>>

Fetch multiple messages.

source

pub async fn send_message( &self, channel_id: impl Into<String>, payload: SendMessagePayload ) -> impl Future<Output = Result<Message, Error>>

Send a message to a given channel.

source

pub async fn search_for_messages( &self, channel_id: impl Into<String>, payload: SearchForMessagesPayload ) -> impl Future<Output = Result<Message, Error>>

Search for messages within the given parameters.

source

pub async fn fetch_message( &self, channel_id: impl Into<String>, message_id: impl Into<String> ) -> impl Future<Output = Result<Message, Error>>

Retrieves a message by its ID.

source

pub async fn delete_message( &self, channel_id: impl Into<String>, message_id: impl Into<String> ) -> impl Future<Output = Result<(), Error>>

Delete a message you’ve sent or one you have permission to delete.

source

pub async fn edit_message( &self, channel_id: impl Into<String>, message_id: impl Into<String>, payload: EditMessagePayload ) -> impl Future<Output = Result<Message, Error>>

source

pub async fn bulk_delete_messages( &self, channel_id: impl Into<String>, payload: BulkDeleteMessagesPayload ) -> impl Future<Output = Result<(), Error>>

Delete multiple messages you’ve sent or one you have permission to delete.

This will always require ManageMessages permission regardless of whether you own the message or not.

Messages must have been sent within the past 1 week.

source§

impl Client

source

pub async fn join_call( &self, id: impl Into<String> ) -> impl Future<Output = Result<VoiceAuthenticationData, Error>>

Asks the voice server for a token to join the call

source§

impl Client

source

pub async fn fetch_emoji( &self, id: impl Into<String> ) -> impl Future<Output = Result<Emoji, Error>>

Fetch an emoji by its ID.

source

pub async fn create_new_emoji( &self, id: impl Into<String>, payload: CreateEmojiPayload ) -> impl Future<Output = Result<Emoji, Error>>

Create an emoji by its Autumn upload id.

source

pub async fn delete_emoji( &self, id: impl Into<String> ) -> impl Future<Output = Result<(), Error>>

Delete an emoji by its id

source§

impl Client

source

pub async fn fetch_invite( &self, id: impl Into<String> ) -> impl Future<Output = Result<Invite, Error>>

Fetch an invite by its ID.

source

pub async fn join_invite( &self, id: impl Into<String> ) -> impl Future<Output = Result<InviteJoin, Error>>

Join an invite by its ID.

source

pub async fn delete_invite( &self, id: impl Into<String> ) -> impl Future<Output = Result<(), Error>>

Delete an invite by its ID.

source§

impl Client

source

pub async fn fetch_settings( &self, payload: FetchMessagesPayload ) -> impl Future<Output = Result<HashMap<String, (i64, String), RandomState>, Error>>

Fetch settings from server filtered by keys.

source

pub async fn set_settings( &self, payload: HashMap<String, String, RandomState> ) -> impl Future<Output = Result<(), Error>>

Upload data to save to settings.

source

pub async fn fetch_unreads( &self ) -> impl Future<Output = Result<Vec<ChannelUnread, Global>, Error>>

Fetch information about unread state on channels.

source§

impl Client

source

pub async fn push_subscribe( &self, payload: PushSubscribePayload ) -> impl Future<Output = Result<(), Error>>

Create a new Web Push subscription.

If an existing subscription exists on this session, it will be removed.

source

pub async fn push_unsubscribe(&self) -> impl Future<Output = Result<(), Error>>

Remove the Web Push subscription associated with the current session.

source§

impl Client

source

pub async fn query_stats(&self) -> impl Future<Output = Result<Stats, Error>>

Fetch various technical statistics.

source

pub async fn globally_fetch_messages( &self, payload: FetchMessagesPayload ) -> impl Future<Output = Result<BulkMessageResponse, Error>>

This is a privileged route to globally fetch messages.

source§

impl Client

source

pub async fn edit_report( &self, report: impl Into<String>, payload: EditReportPayload ) -> impl Future<Output = Result<Report, Error>>

Edit a report.

source

pub async fn fetch_report( &self, id: impl Into<String> ) -> impl Future<Output = Result<Report, Error>>

Fetch a report by its ID.

source

pub async fn fetch_reports( &self ) -> impl Future<Output = Result<Vec<Report, Global>, Error>>

Fetch all available reports

source

pub async fn report_content( &self, payload: ReportContentPayload ) -> impl Future<Output = Result<(), Error>>

Report a piece of content to the moderation team.

source

pub async fn fetch_snapshot( &self, report_id: impl Into<String> ) -> impl Future<Output = Result<Snapshot, Error>>

Fetch a snapshot for a given report.

source§

impl Client

source

pub async fn query_node( &self ) -> impl Future<Output = Result<InstanceConfiguration, Error>>

source§

impl Client

source

pub async fn create_server( &self, payload: CreateServerPayload ) -> impl Future<Output = Result<Server, Error>>

Create a new server.

source

pub async fn fetch_server( &self, id: impl Into<String> ) -> impl Future<Output = Result<Server, Error>>

Deletes a server if owner otherwise leaves.

source

pub async fn delete_or_leave_server( &self, id: impl Into<String> ) -> impl Future<Output = Result<(), Error>>

Deletes a server if owner otherwise leaves.

source

pub async fn edit_server( &self, id: impl Into<String>, payload: EditServerPayload ) -> impl Future<Output = Result<Server, Error>>

Edit a server by its id.

source

pub async fn mark_server_as_read( &self, id: impl Into<String> ) -> impl Future<Output = Result<(), Error>>

Mark all channels in a server as read.

source

pub async fn create_channel( &self, server_id: impl Into<String>, payload: CreateChannelPayload ) -> impl Future<Output = Result<Channel, Error>>

Create a new Text or Voice channel

source§

impl Client

source

pub async fn fetch_members( &self, server_id: impl Into<String>, payload: FetchMembersPayload ) -> impl Future<Output = Result<MemberList, Error>>

Fetch all server members.

source

pub async fn fetch_member( &self, server_id: impl Into<String>, member_id: impl Into<String> ) -> impl Future<Output = Result<Member, Error>>

Retreive a member.

source

pub async fn kick_member( &self, server_id: impl Into<String>, member_id: impl Into<String> ) -> impl Future<Output = Result<(), Error>>

Remove a member from the server.

source

pub async fn edit_member( &self, server_id: impl Into<String>, member_id: impl Into<String>, payload: EditMemberPayload ) -> impl Future<Output = Result<Member, Error>>

Edit a member by their ID.

source

pub async fn ban_user( &self, server_id: impl Into<String>, user_id: impl Into<String>, payload: BanUserPayload ) -> impl Future<Output = Result<ServerBan, Error>>

Ban a user by their ID.

source

pub async fn unban_user( &self, server_id: impl Into<String>, user_id: impl Into<String> ) -> impl Future<Output = Result<(), Error>>

Remove a user’s ban.

source

pub async fn fetch_bans( &self, server_id: impl Into<String> ) -> impl Future<Output = Result<BanList, Error>>

Fetch all bans on a server.

source

pub async fn fetch_invites( &self, server_id: impl Into<String> ) -> impl Future<Output = Result<PartialInvite, Error>>

Fetch all server invites.

source§

impl Client

source

pub async fn create_role( &self, server_id: impl Into<String>, payload: CreateRolePayload ) -> impl Future<Output = Result<NewRole, Error>>

Creates a new server role.

source

pub async fn delete_role( &self, server_id: impl Into<String>, role_id: impl Into<String> ) -> impl Future<Output = Result<(), Error>>

Delete a server role by its ID.

source

pub async fn edit_role( &self, server_id: impl Into<String>, role_id: impl Into<String>, payload: EditRolePayload ) -> impl Future<Output = Result<Role, Error>>

Edit a role by its ID.

source

pub async fn set_role_permission( &self, server_id: impl Into<String>, role_id: impl Into<String>, payload: SetServerRolePermissionPayload ) -> impl Future<Output = Result<Server, Error>>

Sets permissions for the specified role in the server.

source

pub async fn set_default_permission( &self, server_id: impl Into<String>, payload: SetDefaultRolePermissionPayload ) -> impl Future<Output = Result<Server, Error>>

Sets permissions for the default role in the server.

source§

impl Client

source

pub async fn fetch_direct_message_channels( &self ) -> impl Future<Output = Result<Vec<Channel, Global>, Error>>

This fetches your direct messages, including any DM and group DM conversations.

source

pub async fn open_direct_message( &self, id: impl Into<String> ) -> impl Future<Output = Result<Channel, Error>>

Open a DM with another user.

If the target is oneself, a saved messages channel is returned.

source§

impl Client

source

pub async fn fetch_mutual_friends_and_servers( &self, id: impl Into<String> ) -> impl Future<Output = Result<Mutuals, Error>>

This fetches your direct messages, including any DM and group DM conversations.

source

pub async fn accept_friend_request( &self, id: impl Into<String> ) -> impl Future<Output = Result<User, Error>>

Accept another user’s friend request

source

pub async fn remove_or_deny_friend( &self, id: impl Into<String> ) -> impl Future<Output = Result<User, Error>>

Denies another user’s friend request or removes an existing friend.

source

pub async fn block_user( &self, id: impl Into<String> ) -> impl Future<Output = Result<User, Error>>

Block another user by their id.

source

pub async fn unblock_user( &self, id: impl Into<String> ) -> impl Future<Output = Result<User, Error>>

Unblock another user by their id.

source

pub async fn send_friend_request( &self, payload: SendFriendRequestPayload ) -> impl Future<Output = Result<User, Error>>

Send a friend request to another user.

source§

impl Client

source

pub async fn fetch_self(&self) -> impl Future<Output = Result<User, Error>>

Retrieve your user information.

source

pub async fn edit_user( &self, payload: EditUserPayload ) -> impl Future<Output = Result<User, Error>>

Edit currently authenticated user.

source

pub async fn fetch_user( &self, id: impl Into<String> ) -> impl Future<Output = Result<User, Error>>

Fetch a user’s information.

source

pub async fn change_username( &self, payload: ChangeUsernamePayload ) -> impl Future<Output = Result<User, Error>>

Change your username.

source

pub async fn fetch_default_avatar( &self, id: impl Into<String> ) -> impl Future<Output = Result<Vec<u8, Global>, Error>>

This returns a default avatar based on the given id.

source

pub async fn fetch_user_profile( &self, id: impl Into<String> ) -> impl Future<Output = Result<UserProfile, Error>>

Retrieve a user’s profile data.

Will fail if you do not have permission to access the other user’s profile.

source§

impl Client

source

pub fn new(authentication: Authentication) -> Client

source

pub fn new_base_url( authentication: Authentication, base_url: impl Into<String> ) -> Client

Trait Implementations§

source§

impl Clone for Client

source§

fn clone(&self) -> Client

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Client

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more