Struct kuon::TweetRequest[][src]

pub struct TweetRequest<'a, Status> { /* fields omitted */ }

Example

let api = kuon::TwitterAPI::new_using_env().await?;
let res = api.tweet().status("this is test tweet from kuon.").send().await?;

POST statuses/update

Updates the authenticating user’s current status, also known as Tweeting.

For each update attempt, the update text is compared with the authenticating user’s recent Tweets. Any attempt that would result in duplication will be blocked, resulting in a 403 error. A user cannot submit the same status twice in a row.

While not rate limited by the API, a user is limited in the number of Tweets they can create at a time. If the number of updates posted by the user reaches the current allowed limit this method will return an HTTP 403 error.

About Geo

  • Any geo-tagging parameters in the update will be ignored if geo_enabled for the user is false (this is the default setting for all users, unless the user has enabled geolocation in their settings)
  • The number of digits after the decimal separator passed to lat (up to 8) is tracked so that when the lat is returned in a status object it will have the same number of digits after the decimal separator.
  • Use a decimal point as the separator (and not a decimal comma) for the latitude and the longitude - usage of a decimal comma will cause the geo-tagged portion of the status update to be dropped.
  • For JSON, the response mostly uses conventions described in GeoJSON. However, the geo object coordinates that Twitter renders are reversed from the GeoJSON specification. GeoJSON specifies a longitude then a latitude, whereas Twitter represents it as a latitude then a longitude: “geo”: { “type”:“Point”, “coordinates”:[37.78217, -122.40062] }
  • The coordinates object is replacing the geo object (no deprecation date has been set for the geo object yet) – the difference is that the coordinates object, in JSON, is now rendered correctly in GeoJSON.
  • If a place_id is passed into the status update, then that place will be attached to the status. If no place_id was explicitly provided, but latitude and longitude are, the API attempts to implicitly provide a place by calling geo/reverse_geocode.
  • Users have the ability to remove all geotags from all their Tweets en masse via the user settings page. Currently there is no method to remove geotags from individual Tweets.
Q.A.
Requires authentication?Yes (user context only)
Rate limited?Yes
Requests / 3-hour window300* per user; 300* per app

https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-update

Implementations

impl<'a> Tweet<'a, ()>[src]

pub fn status<Status>(self, status: Status) -> Tweet<'a, Status> where
    Status: ToString
[src]

(required) The text of the status update. URL encode as necessary. t.co link wrapping will affect character counts.

impl<'a, Status> Tweet<'a, Status>[src]

pub fn in_reply_to_status_id(&mut self, in_reply_to_status_id: u64) -> &mut Self[src]

The ID of an existing status that the update is in reply to. Note: This parameter will be ignored unless the author of the Tweet this parameter references is mentioned within the status text. Therefore, you must include @username , where username is the author of the referenced Tweet, within the update.

pub fn auto_populate_reply_metadata(
    &mut self,
    auto_populate_reply_metadata: impl Into<bool>
) -> &mut Self
[src]

If set to true and used with in_reply_to_status_id, leading @mentions will be looked up from the original Tweet, and added to the new Tweet from there. This wil append @mentions into the metadata of an extended Tweet as a reply chain grows, until the limit on @mentions is reached. In cases where the original Tweet has been deleted, the reply will fail.

pub fn exclude_reply_user_ids(
    &mut self,
    exclude_reply_user_ids: impl Into<Vec<u64>>
) -> &mut Self
[src]

When used with auto_populate_reply_metadata, a comma-separated list of user ids which will be removed from the server-generated @mentions prefix on an extended Tweet. Note that the leading @mention cannot be removed as it would break the in-reply-to-status-id semantics. Attempting to remove it will be silently ignored.

pub fn attachment_url(&mut self, attachment_url: impl Into<String>) -> &mut Self[src]

In order for a URL to not be counted in the status body of an extended Tweet, provide a URL as a Tweet attachment. This URL must be a Tweet permalink, or Direct Message deep link. Arbitrary, non-Twitter URLs must remain in the status text. URLs passed to the attachment_url parameter not matching either a Tweet permalink or Direct Message deep link will fail at Tweet creation and cause an exception.

pub fn media_ids(&mut self, media_ids: impl Into<Vec<u64>>) -> &mut Self[src]

A comma-delimited list of media_ids to associate with the Tweet. You may include up to 4 photos or 1 animated GIF or 1 video in a Tweet. See Uploading Media for further details on uploading media.

pub fn possibly_sensitive(
    &mut self,
    possibly_sensitive: impl Into<bool>
) -> &mut Self
[src]

If you upload Tweet media that might be considered sensitive content such as nudity, or medical procedures, you must set this value to true. See Media setting and best practices for more context.

pub fn lat(&mut self, lat: impl Into<f64>) -> &mut Self[src]

The latitude of the location this Tweet refers to. This parameter will be ignored unless it is inside the range -90.0 to +90.0 (North is positive) inclusive. It will also be ignored if there is no corresponding long parameter.

pub fn long(&mut self, long: impl Into<f64>) -> &mut Self[src]

The longitude of the location this Tweet refers to. The valid ranges for longitude are -180.0 to +180.0 (East is positive) inclusive. This parameter will be ignored if outside that range, if it is not a number, if geo_enabled is turned off, or if there no corresponding lat parameter.

pub fn place_id(&mut self, place_id: impl Into<String>) -> &mut Self[src]

A place in the world.

pub fn display_coordinates(
    &mut self,
    display_coordinates: impl Into<bool>
) -> &mut Self
[src]

Whether or not to put a pin on the exact coordinates a Tweet has been sent from.

pub fn trim_user(&mut self, trim_user: impl Into<bool>) -> &mut Self[src]

When set to either true , t or 1 , the response will include a user object including only the author’s ID. Omit this parameter to receive the complete user object.

pub fn enable_dmcommands(
    &mut self,
    enable_dmcommands: impl Into<bool>
) -> &mut Self
[src]

When set to true, enables shortcode commands for sending Direct Messages as part of the status text to send a Direct Message to a user. When set to false, it turns off this behavior and includes any leading characters in the status text that is posted

pub fn fail_dmcommands(&mut self, fail_dmcommands: impl Into<bool>) -> &mut Self[src]

When set to true, causes any status text that starts with shortcode commands to return an API error. When set to false, allows shortcode commands to be sent in the status text and acted on by the API.

pub fn card_uri(&mut self, card_uri: impl Into<String>) -> &mut Self[src]

Associate an ads card with the Tweet using the card_uri value from any ads card response.

impl<'a, Status> Tweet<'a, Status> where
    Status: ToString
[src]

pub async fn send(&self) -> Result<TrimTweet, Error>[src]

Trait Implementations

impl<'a, Status: Clone> Clone for Tweet<'a, Status>[src]

fn clone(&self) -> Tweet<'a, Status>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'a, Status: Debug> Debug for Tweet<'a, Status>[src]

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

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<'a, Status> !RefUnwindSafe for Tweet<'a, Status>

impl<'a, Status> Send for Tweet<'a, Status> where
    Status: Send

impl<'a, Status> Sync for Tweet<'a, Status> where
    Status: Sync

impl<'a, Status> Unpin for Tweet<'a, Status> where
    Status: Unpin

impl<'a, Status> !UnwindSafe for Tweet<'a, Status>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

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

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

fn in_current_span(self) -> Instrumented<Self>[src]

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.