Struct egg_mode::service::Configuration[][src]

pub struct Configuration {
    pub dm_text_character_limit: i32,
    pub photo_sizes: MediaSizes,
    pub short_url_length: i32,
    pub short_url_length_https: i32,
    pub non_username_paths: Vec<String>,
}
Expand description

Represents a service configuration from Twitter.

The values returned in this struct are various pieces of information that, while they don’t change often, have the opportunity to change over time and affect things like character counting or whether to route a twitter.com URL to a user lookup or a browser.

While tweets themselves still have a fixed 280-character limit, direct messages have had their text limit expanded to 10,000 characters, and that length is communicated here, in dm_text_character_limit.

For photo_sizes, note that if your image is smaller than the dimensions given for a particular size, that size variant will simply return your source image as-is. If either dimension is larger than its corresponding dimension here, it will be scaled according to the included resize property. In practice this usually means thumb will crop to its dimensions, and each other variant will resize down, keeping its aspect ratio.

For best ways to handle the short_url_length fields, see Twitter’s documentation on t.co URLs. In short, every URL Twitter detects in a new tweet or direct message gets a new t.co URL created for it, which replaces the original URL in the given text. This affects character counts for these fields, so if your app is counting characters and detects a URL for these fields, treat the whole URL as if it were as long as the number of characters given in this struct.

Finally, loading non_username_paths allows you to handle twitter.com/[name] links as if they were a user mention, while still keeping site-level links working properly.

Fields

dm_text_character_limit: i32

The character limit in direct messages.

photo_sizes: MediaSizes

The maximum dimensions for each photo size variant.

short_url_length: i32

The maximum length for a t.co URL when given a URL with protocol http.

short_url_length_https: i32

The maximum length for a t.co URL when given a URL with protocol https.

non_username_paths: Vec<String>

A list of URL slugs that are not valid usernames when in a URL like twitter.com/[slug].

Trait Implementations

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

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

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

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.