[−][src]Module egg_mode::media
Functionality to upload images, GIFs, and videos that can be attached to tweets.
Tweet media is uploaded separately from the act of posting the tweet itself.
In order to attach an image to a new tweet, you need to upload it first,
then take the Media ID that Twitter generates and reference that when posting the tweet.
The media id is returned as part of the result of a call to upload_media
.
Here's a basic example of uploading an image and attaching to a tweet:
use egg_mode::media::{upload_media, media_types}; use egg_mode::tweet::DraftTweet; let image = b"some image bytes"; //pretend we loaded an image file into this let handle = upload_media(image, &media_types::image_png(), &token).await?; let draft = DraftTweet::new("Hey, check out this cute cat!"); draft.add_media(handle.id); let tweet = draft.send(&token).await?;
Modules
media_types | A collection of convenience functions that return media types accepted by Twitter. |
Structs
MediaHandle | A handle representing uploaded media. |
MediaId | An opaque type representing a media id. |
Enums
ProgressInfo | Upload progress info. |
Functions
get_status | Check the status of uploaded media |
set_metadata | Set metadata for a media upload. At the moment the only attribute that may
be set is |
upload_media | Upload media to the server. |