NoteBuilder

Struct NoteBuilder 

Source
pub struct NoteBuilder<C> { /* private fields */ }
Expand description

Builder for the build_note method.

Implementations§

Source§

impl<C> NoteBuilder<C>

Source

pub fn new(client: C) -> Self

Creates a builder with the client.

Source

pub fn as_request(&self) -> &Request

Gets the request object for reuse.

Source

pub fn text(&mut self, text: impl Into<String>) -> &mut Self

Sets the text of the note.

Source

pub fn poll( &mut self, choices: impl IntoIterator<Item = impl Into<String>>, ) -> &mut Self

Creates a poll and sets the choices.

Source

pub fn poll_multiple(&mut self, multiple: bool) -> &mut Self

Sets whether to allow multiple votes.

Source

pub fn poll_expires_at(&mut self, at: DateTime<Utc>) -> &mut Self

Sets when the vote will expire.

Source

pub fn poll_expires_after(&mut self, after: Duration) -> &mut Self

Sets how long the vote will expire after.

Source

pub fn attach_file(&mut self, file: impl EntityRef<DriveFile>) -> &mut Self

Attaches the specified file to the note.

Source

pub fn attach_files( &mut self, files: impl IntoIterator<Item = impl EntityRef<DriveFile>>, ) -> &mut Self

Adds attachments to the note.

Source

pub fn visibility(&mut self, visibility: Visibility) -> &mut Self

Sets the visibility of the note.

Source

pub fn public(&mut self) -> &mut Self

Sets the note to be visible to everyone.

This is equivalent to .visibility(Visibility::Public).

Source

pub fn home_only(&mut self) -> &mut Self

Sets the note to be visible only to the home timeline.

This is equivalent to .visibility(Visibility::Home).

Source

pub fn followers_only(&mut self) -> &mut Self

Sets the note to be visible only to the followers.

This is equivalent to .visibility(Visibility::Followers).

Source

pub fn direct( &mut self, recipients: impl IntoIterator<Item = impl EntityRef<User>>, ) -> &mut Self

Sets the note to be visible only to the specified users.

Source

pub fn hide_content(&mut self, cw_text: impl Into<String>) -> &mut Self

Hides the contents of the note as a content warning with the specified text.

Source

pub fn via_mobile(&mut self, via_mobile: bool) -> &mut Self

Sets whether to show the note as posted from a mobile device.

Source

pub fn local_only(&mut self, local_only: bool) -> &mut Self

Sets the note to be visible only to users on the same instance.

Source

pub fn extract_mentions(&mut self, extract_mentions: bool) -> &mut Self

Sets whether or not to extract mentions (i.e. @username) from the text of the note.

Mentions are extracted by default, and you would need this method if you want to disable this behavior.

Source

pub fn extract_hashtags(&mut self, extract_hashtags: bool) -> &mut Self

Sets whether or not to extract hashtags (i.e. #tag) from the text of the note.

Hashtags are extracted by default, and you would need this method if you want to disable this behavior.

Source

pub fn extract_emojis(&mut self, extract_emojis: bool) -> &mut Self

Sets whether or not to extract emojis (i.e. :emoji:) from the text of the note.

Emojis are extracted by default, and you would need this method if you want to disable this behavior.

Source

pub fn reply(&mut self, note: impl EntityRef<Note>) -> &mut Self

Sets the note as a reply to the specified note.

Source

pub fn renote(&mut self, note: impl EntityRef<Note>) -> &mut Self

Sets the note as a renote of the specified note.

Source

pub fn channel(&mut self, channel: impl EntityRef<Channel>) -> &mut Self

Available on crate feature 12-47-0 only.

Sets the note to be posted to the specified channel.

Source§

impl<C: Client> NoteBuilder<C>

Source

pub async fn create(&self) -> Result<Note, Error<C::Error>>

Creates the note.

Auto Trait Implementations§

§

impl<C> Freeze for NoteBuilder<C>
where C: Freeze,

§

impl<C> RefUnwindSafe for NoteBuilder<C>
where C: RefUnwindSafe,

§

impl<C> Send for NoteBuilder<C>
where C: Send,

§

impl<C> Sync for NoteBuilder<C>
where C: Sync,

§

impl<C> Unpin for NoteBuilder<C>
where C: Unpin,

§

impl<C> UnwindSafe for NoteBuilder<C>
where C: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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, U> Into<U> for T
where 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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> ErasedDestructor for T
where T: 'static,