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>,
}

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 140-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

The character limit in direct messages.

The maximum dimensions for each photo size variant.

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

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

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

Trait Implementations

impl Debug for Configuration
[src]

[src]

Formats the value using the given formatter.