Struct egg_mode::tweet::DraftTweet [] [src]

pub struct DraftTweet<'a> {
    pub text: &'a str,
    pub in_reply_to: Option<u64>,
    pub auto_populate_reply_metadata: Option<bool>,
    pub exclude_reply_user_ids: Option<&'a [u64]>,
    pub attachment_url: Option<&'a str>,
    pub coordinates: Option<(f64, f64)>,
    pub display_coordinates: Option<bool>,
    pub place_id: Option<&'a str>,
}

Represents an in-progress tweet before it is sent.

This is your entry point to posting new tweets to Twitter. To begin, make a new DraftTweet by calling new with your desired status text:

use egg_mode::tweet::DraftTweet;

let draft = DraftTweet::new("This is an example status!");

As-is, the draft won't do anything until you call send to post it:

core.run(draft.send(&token, &handle)).unwrap();

Right now, the options for adding metadata to a post are pretty sparse. See the adaptor functions below to see what metadata can be set. For example, you can use in_reply_to to create a reply-chain like this:

use egg_mode::tweet::DraftTweet;

let draft = DraftTweet::new("I'd like to start a thread here.");
let tweet = core.run(draft.send(&token, &handle)).unwrap();

let draft = DraftTweet::new("You see, I have a lot of things to say.")
                       .in_reply_to(tweet.id);
let tweet = core.run(draft.send(&token, &handle)).unwrap();

let draft = DraftTweet::new("Thank you for your time.")
                       .in_reply_to(tweet.id);
let tweet = core.run(draft.send(&token, &handle)).unwrap();

Fields

The text of the draft tweet.

If present, the ID of the tweet this draft is replying to.

If present, whether to automatically fill reply mentions from the metadata of the in_reply_to tweet.

If present, the list of user IDs to exclude from the automatically-populated metadata pulled when auto_populate_reply_metadata is true.

If present, the tweet link to quote or a DM deep link to include in the tweet's attachment metadata.

Note that if this link is not a tweet link or a DM deep link, Twitter will return an error when the draft is sent.

If present, the latitude/longitude coordinates to attach to the draft.

If present (and if coordinates is present), indicates whether to display a pin on the exact coordinate when the eventual tweet is displayed.

If present the Place to attach to this draft.

Methods

impl<'a> DraftTweet<'a>
[src]

[src]

Creates a new DraftTweet with the given status text.

[src]

Marks this draft tweet as replying to the given status ID.

Note that this will only properly take effect if the user who posted the given status is @mentioned in the status text, or if the given status was posted by the authenticated user.

[src]

Tells Twitter whether or not to automatically fill reply mentions from the tweet linked in in_reply_to.

This parameter will have no effect if in_reply_to is absent.

If you set this to true, you can strip out the mentions from the beginning of the tweet text if they were also in the reply mentions of the parent tweet. To remove handles from the list of reply mentions, hand their user IDs to exclude_reply_user_ids.

[src]

Tells Twitter to exclude the given list of user IDs from the automatically-populated reply mentions.

This parameter will have no effect if auto_populate_reply_metadata is absent or false.

Note that you cannot use this parameter to remove the author of the parent tweet from the reply list. Twitter will silently ignore the author's ID in that scenario.

[src]

Attaches the given tweet URL or DM deep link to the tweet draft, which lets it be used outside the 140 character text limit.

Note that if this link is not a tweet URL or a DM deep link, then Twitter will return an error when this draft is sent.

[src]

Attach a lat/lon coordinate to this tweet, and mark whether a pin should be placed on the exact coordinate when the tweet is displayed.

If coordinates are given through this method and no place_id is attached, Twitter will effectively call place::reverse_geocode with the given coordinate and attach that Place to the eventual tweet.

Location fields will be ignored unless the user has enabled geolocation from their profile.

[src]

Attach a Place to this tweet. This field will take precedence over coordinates in terms of what location is displayed with the tweet.

Location fields will be ignored unless the user has enabled geolocation from their profile.

[src]

Send the assembled tweet as the authenticated user.

Trait Implementations

impl<'a> Debug for DraftTweet<'a>
[src]

[src]

Formats the value using the given formatter.

impl<'a> Clone for DraftTweet<'a>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more