Struct rive_http::Client

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

Implementations§

source§

impl Client

source

pub async fn create_account(&self, data: CreateAccountData) -> Result<(), Error>

Create a new account.

source

pub async fn resend_verification( &self, data: ResendVerificationData ) -> Result<(), Error>

Resend account creation verification email.

source

pub async fn confirm_account_deletion( &self, data: ConfirmAccountDeletionData ) -> Result<(), Error>

Schedule an account for deletion by confirming the received token.

source

pub async fn delete_account(&self) -> Result<(), Error>

Request to have an account deleted.

source

pub async fn fetch_account(&self) -> Result<AccountInfo, Error>

Fetch account information from the current session.

source

pub async fn disable_account(&self) -> Result<(), Error>

Disable an account.

source

pub async fn change_password( &self, data: ChangePasswordData ) -> Result<(), Error>

Change the current account password.

source

pub async fn change_email(&self, data: ChangeEmailData) -> Result<(), Error>

Change the associated account email.

source

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

Change the associated account email.

source

pub async fn send_password_reset( &self, data: SendPasswordResetData ) -> Result<(), Error>

Send an email to reset account password.

source

pub async fn password_reset(&self, data: PasswordResetData) -> Result<(), Error>

Confirm password reset and change the password.

source§

impl Client

source

pub async fn create_mfa_ticket( &self, data: CreateMFATicketData ) -> Result<MFATicket, Error>

Create a new MFA ticket or validate an existing one.

source

pub async fn fetch_mfa_status(&self) -> Result<MFAStatus, Error>

Fetch MFA status of an account.

source

pub async fn fetch_recovery_codes(&self) -> Result<Vec<MFARecoveryCode>, Error>

Fetch recovery codes for an account.

source

pub async fn generate_recovery_codes( &self ) -> Result<Vec<MFARecoveryCode>, Error>

Re-generate recovery codes for an account.

source

pub async fn get_mfa_methods(&self) -> Result<Vec<MFAMethod>, Error>

Fetch available MFA methods.

source

pub async fn enable_totp_2fa( &self, data: EnableTOTP2FAData ) -> Result<(), Error>

Enable TOTP 2FA for an account.

source

pub async fn generate_totp_secret(&self) -> Result<TOTPSecret, Error>

Generate a new secret for TOTP.

source

pub async fn disable_totp_2fa(&self) -> Result<(), Error>

Disable TOTP 2FA for an account.

source§

impl Client

source

pub async fn check_onboarding_status(&self) -> 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, data: CompleteOnboardingData ) -> 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, data: LoginData) -> Result<LoginResponse, Error>

Login to an account.

source

pub async fn logout(&self) -> Result<(), Error>

Delete current session.

source

pub async fn fetch_sessions(&self) -> Result<Vec<SessionInfo>, Error>

Fetch all sessions associated with this account.

source

pub async fn delete_all_sessions( &self, data: DeleteAllSessionsData ) -> Result<(), Error>

Delete all active sessions, optionally including current one.

source

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

Delete a specific active session.

source

pub async fn edit_session( &self, id: impl Into<String>, data: EditSessionData ) -> Result<SessionInfo, Error>

Edit specific session information.

source§

impl Client

source

pub async fn create_bot(&self, data: CreateBotData) -> Result<Bot, Error>

Create a new Revolt bot.

source

pub async fn fetch_public_bot( &self, id: impl Into<String> ) -> 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>, data: InviteBotData ) -> Result<(), Error>

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

source

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

Fetch details of a bot you own by its id.

source

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

Delete a bot by its id.

source

pub async fn edit_bot( &self, id: impl Into<String>, data: EditBotData ) -> Result<Bot, Error>

Edit bot details by its id.

source

pub async fn fetch_owned_bots(&self) -> 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> ) -> Result<Channel, Error>

Fetch channel by its ID.

source

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

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

source

pub async fn edit_channel( &self, id: impl Into<String>, data: EditChannelData ) -> Result<Channel, Error>

Edit a channel object by its id.

source§

impl Client

source

pub async fn create_invite( &self, id: impl Into<String> ) -> 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>, data: SetRolePermissionData ) -> 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>, data: SetDefaultPermissionData ) -> 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> ) -> Result<Vec<User>, Error>

Retrieves all users who are part of this group.

source

pub async fn create_group( &self, data: CreateGroupData ) -> 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> ) -> 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> ) -> 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> ) -> 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>, data: RemoveReactionToMessageData ) -> 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> ) -> 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> ) -> 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>, data: FetchMessagesData ) -> Result<BulkMessageResponse, Error>

Fetch multiple messages.

source

pub async fn send_message( &self, channel_id: impl Into<String>, data: SendMessageData ) -> Result<Message, Error>

Send a message to a given channel.

source

pub async fn search_for_messages( &self, channel_id: impl Into<String>, data: SearchForMessagesData ) -> 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> ) -> 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> ) -> 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>, data: EditMessageData ) -> Result<Message, Error>

source

pub async fn bulk_delete_messages( &self, channel_id: impl Into<String>, data: BulkDeleteMessagesData ) -> 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> ) -> Result<VoiceAuthenticationData, Error>

Asks the voice server for a token to join the call

source§

impl Client

source

pub async fn create_webhook( &self, channel_id: impl Into<String>, data: CreateWebhookData ) -> Result<Webhook, Error>

Create a webhook which 3rd party platforms can use to send messages.

source

pub async fn get_all_webhooks( &self, channel_id: impl Into<String> ) -> Result<Vec<Webhook>, Error>

Get all webhooks inside the channel.

source§

impl Client

source

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

Fetch an emoji by its ID.

source

pub async fn create_new_emoji( &self, id: impl Into<String>, data: CreateEmojiData ) -> Result<Emoji, Error>

Create an emoji by its Autumn upload id.

source

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

Delete an emoji by its id

source§

impl Client

source

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

Fetch an invite by its ID.

source

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

Join an invite by its ID.

source

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

Delete an invite by its ID.

source§

impl Client

source

pub async fn fetch_settings( &self, data: FetchMessagesData ) -> Result<UserSettings, Error>

Fetch settings from server filtered by keys.

source

pub async fn set_settings( &self, data: HashMap<String, String> ) -> Result<(), Error>

Upload data to save to settings.

source

pub async fn fetch_unreads(&self) -> Result<Vec<ChannelUnread>, Error>

Fetch information about unread state on channels.

source§

impl Client

source

pub async fn push_subscribe(&self, data: PushSubscribeData) -> 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) -> Result<(), Error>

Remove the Web Push subscription associated with the current session.

source§

impl Client

source

pub async fn query_stats(&self) -> Result<Stats, Error>

Fetch various technical statistics.

source

pub async fn globally_fetch_messages( &self, data: FetchMessagesData ) -> 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>, data: EditReportData ) -> Result<Report, Error>

Edit a report.

source

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

Fetch a report by its ID.

source

pub async fn fetch_reports(&self) -> Result<Vec<Report>, Error>

Fetch all available reports

source

pub async fn report_content(&self, data: ReportContentData) -> Result<(), Error>

Report a piece of content to the moderation team.

source

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

Fetch a snapshot for a given report.

source

pub async fn create_strike( &self, data: CreateStrikeData ) -> Result<AccountStrike, Error>

Create a new account strike.

source

pub async fn fetch_strikes( &self, user_id: impl Into<String> ) -> Result<AccountStrike, Error>

Fetch strikes for a user by their ID.

source

pub async fn edit_strike( &self, strike_id: impl Into<String>, data: EditAccountStrikeData ) -> Result<(), Error>

Edit a strike by its ID.

source

pub async fn delete_strike( &self, strike_id: impl Into<String> ) -> Result<(), Error>

Edit a strike by its ID.

source§

impl Client

source§

impl Client

source

pub async fn create_server( &self, data: CreateServerData ) -> Result<Server, Error>

Create a new server.

source

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

Deletes a server if owner otherwise leaves.

source

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

Deletes a server if owner otherwise leaves.

source

pub async fn edit_server( &self, id: impl Into<String>, data: EditServerData ) -> Result<Server, Error>

Edit a server by its id.

source

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

Mark all channels in a server as read.

source

pub async fn create_channel( &self, server_id: impl Into<String>, data: CreateChannelData ) -> 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>, data: FetchMembersData ) -> Result<MemberList, Error>

Fetch all server members.

source

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

Retreive a member.

source

pub async fn kick_member( &self, server_id: impl Into<String>, member_id: impl Into<String> ) -> 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>, data: EditMemberData ) -> 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>, data: BanUserData ) -> 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> ) -> Result<(), Error>

Remove a user’s ban.

source

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

Fetch all bans on a server.

source

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

Fetch all server invites.

source§

impl Client

source

pub async fn create_role( &self, server_id: impl Into<String>, data: CreateRoleData ) -> 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> ) -> 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>, data: EditRoleData ) -> 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>, data: SetServerRolePermissionData ) -> 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>, data: SetDefaultRolePermissionData ) -> Result<Server, Error>

Sets permissions for the default role in the server.

source§

impl Client

source

pub async fn fetch_direct_message_channels(&self) -> Result<Vec<Channel>, 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> ) -> 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> ) -> 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> ) -> Result<User, Error>

Accept another user’s friend request

source

pub async fn remove_or_deny_friend( &self, id: impl Into<String> ) -> 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>) -> Result<User, Error>

Block another user by their id.

source

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

Unblock another user by their id.

source

pub async fn send_friend_request( &self, data: SendFriendRequestData ) -> Result<User, Error>

Send a friend request to another user.

source§

impl Client

source

pub async fn fetch_self(&self) -> Result<User, Error>

Retrieve your user information.

source

pub async fn edit_user(&self, data: EditUserData) -> Result<User, Error>

Edit currently authenticated user.

source

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

Fetch a user’s information.

source

pub async fn change_username( &self, data: ChangeUsernameData ) -> Result<User, Error>

Change your username.

source

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

This returns a default avatar based on the given id.

source

pub async fn fetch_user_profile( &self, id: impl Into<String> ) -> 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) -> Self

Create a client instance with the API base URL of Revolt official instance.

source

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

Create a client instance with given base URL.

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

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,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

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>,

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.
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.
source§

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

Performs the conversion.
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