View Source Tw.V1_1.Me (Tw v0.1.0)

Extended Tw.V1_1.User returned by GET account/verify_credentials.

See the Twitter API documentation for details.

Link to this section Summary

Types

Parameters for get/2.

t()
fielddescription
idThe integer representation of the unique identifier for this User. This number is greater than 53 bits and some programming languages may have difficulty/silent defects in interpreting it. Using a signed 64 bit integer for storing this identifier is safe. Use id_str to fetch the identifier to be safe. See Twitter IDs for more information. Example: 6253282.
id_strThe string representation of the unique identifier for this User. Implementations should use this rather than the large, possibly un-consumable integer in id. Example: "6253282".
nameThe name of the user, as they’ve defined it. Not necessarily a person’s name. Typically capped at 50 characters, but subject to change. Example: "Twitter API".
screen_nameThe screen name, handle, or alias that this user identifies themselves with. screen_names are unique but subject to change. Use id_str as a user identifier whenever possible. Typically a maximum of 15 characters long, but some historical accounts may exist with longer names. Example: "twitterapi".
locationNullable . The user-defined location for this account’s profile. Not necessarily a location, nor machine-parseable. This field will occasionally be fuzzily interpreted by the Search service. Example: "San Francisco, CA".
derivedEnterprise APIs only Collection of Enrichment metadata derived for user. Provides the Profile Geo Enrichment metadata. See referenced documentation for more information, including JSON data dictionaries. Example: {"locations": [{"country":"United States","country_code":"US","locality":"Denver"}]}.
urlNullable . A URL provided by the user in association with their profile. Example: "https://developer.twitter.com".
descriptionNullable . The user-defined UTF-8 string describing their account. Example: "The Real Twitter API.".
protectedWhen true, indicates that this user has chosen to protect their Tweets. See About Public and Protected Tweets . Example: true.
verifiedWhen true, indicates that the user has a verified account. See Verified Accounts . Example: false.
followers_countThe number of followers this account currently has. Under certain conditions of duress, this field will temporarily indicate “0”. Example: 21.
friends_countThe number of users this account is following (AKA their “followings”). Under certain conditions of duress, this field will temporarily indicate “0”. Example: 32.
listed_countThe number of public lists that this user is a member of. Example: 9274.
favourites_countThe number of Tweets this user has liked in the account’s lifetime. British spelling used in the field name for historical reasons. Example: 13.
statuses_countThe number of Tweets (including retweets) issued by the user. Example: 42.
created_atThe UTC datetime that the user account was created on Twitter. Example: "Mon Nov 29 21:18:15 +0000 2010".
profile_banner_urlThe HTTPS-based URL pointing to the standard web representation of the user’s uploaded profile banner. By adding a final path element of the URL, it is possible to obtain different image sizes optimized for specific displays. For size variants, please see User Profile Images and Banners .Example: "https://si0.twimg.com/profile_banners/819797/1348102824".
profile_image_url_httpsA HTTPS-based URL pointing to the user’s profile image. Example: "https://abs.twimg.com/sticky/default_profile_images/default_profile_normal.png".
default_profileWhen true, indicates that the user has not altered the theme or background of their user profile. Example: false.
default_profile_imageWhen true, indicates that the user has not uploaded their own profile image and a default image is used instead. Example: false.
withheld_in_countriesWhen present, indicates a list of uppercase two-letter country codes this content is withheld from. Twitter supports the following non-country values for this field:“XX” - Content is withheld in all countries “XY” - Content is withheld due to a DMCA request.Example: ["GR", "HK", "MY"].
withheld_scopeWhen present, indicates that the content being withheld is a “user.”Example: "user".
entities-
show_all_inline_media-
status-
email-

Parameters for update/3.

Parameters for update_profile_banner/3.

Parameters for update_profile_image/3.

Parameters for update_setting/3.

Functions

Decode JSON-decoded map into t/0

Request POST /account/remove_profile_banner.json and return decoded result.

Request GET /account/verify_credentials.json and return decoded result.

Request GET /account/settings.json and return decoded result.

Request POST /account/update_profile.json and return decoded result.

Request POST /account/update_profile_banner.json and return decoded result.

Request POST /account/update_profile_image.json and return decoded result.

Request POST /account/settings.json and return decoded result.

Link to this section Types

Specs

get_params() :: %{
  optional(:include_entities) => boolean(),
  optional(:skip_status) => boolean(),
  optional(:include_email) => boolean()
}

Parameters for get/2.

namedescription
include_entitiesThe entities node will not be included when set to false .
skip_statusWhen set to either true , t or 1 statuses will not be included in the returned user object.
include_emailWhen set to true email will be returned in the user objects as a string. If the user does not have an email address on their account, or if the email address is not verified, null will be returned.

See the Twitter API documentation for details.

Specs

setting() :: %{
  allow_contributor_request: binary(),
  allow_dm_groups_from: binary(),
  allow_dms_from: binary(),
  always_use_https: boolean(),
  discoverable_by_email: boolean(),
  discoverable_by_mobile_phone: boolean(),
  display_sensitive_media: boolean(),
  geo_enabled: boolean(),
  language: binary(),
  protected: boolean(),
  screen_name: binary(),
  sleep_time: %{
    enabled: boolean(),
    end_time: non_neg_integer() | nil,
    start_time: non_neg_integer() | nil
  },
  time_zone: %{name: binary(), tzinfo_name: binary(), utc_offset: integer()},
  translator_type: binary(),
  trend_location: nil | [Tw.V1_1.TrendLocation.t()],
  use_cookie_personalization: boolean()
}

Specs

t() :: %Tw.V1_1.Me{
  created_at: DateTime.t(),
  default_profile: boolean(),
  default_profile_image: boolean(),
  derived: [map()],
  description: binary() | nil,
  email: binary() | nil,
  entities: Tw.V1_1.UserEntities.t() | nil,
  favourites_count: integer(),
  followers_count: integer(),
  friends_count: integer(),
  id: integer(),
  id_str: binary(),
  listed_count: integer(),
  location: binary() | nil,
  name: binary(),
  profile_banner_url: binary(),
  profile_image_url_https: binary(),
  protected: boolean(),
  screen_name: binary(),
  show_all_inline_media: boolean(),
  status: Tw.V1_1.Tweet.t() | nil,
  statuses_count: integer(),
  url: binary() | nil,
  verified: boolean(),
  withheld_in_countries: [binary()],
  withheld_scope: binary()
}
fielddescription
idThe integer representation of the unique identifier for this User. This number is greater than 53 bits and some programming languages may have difficulty/silent defects in interpreting it. Using a signed 64 bit integer for storing this identifier is safe. Use id_str to fetch the identifier to be safe. See Twitter IDs for more information. Example: 6253282.
id_strThe string representation of the unique identifier for this User. Implementations should use this rather than the large, possibly un-consumable integer in id. Example: "6253282".
nameThe name of the user, as they’ve defined it. Not necessarily a person’s name. Typically capped at 50 characters, but subject to change. Example: "Twitter API".
screen_nameThe screen name, handle, or alias that this user identifies themselves with. screen_names are unique but subject to change. Use id_str as a user identifier whenever possible. Typically a maximum of 15 characters long, but some historical accounts may exist with longer names. Example: "twitterapi".
locationNullable . The user-defined location for this account’s profile. Not necessarily a location, nor machine-parseable. This field will occasionally be fuzzily interpreted by the Search service. Example: "San Francisco, CA".
derivedEnterprise APIs only Collection of Enrichment metadata derived for user. Provides the Profile Geo Enrichment metadata. See referenced documentation for more information, including JSON data dictionaries. Example: {"locations": [{"country":"United States","country_code":"US","locality":"Denver"}]}.
urlNullable . A URL provided by the user in association with their profile. Example: "https://developer.twitter.com".
descriptionNullable . The user-defined UTF-8 string describing their account. Example: "The Real Twitter API.".
protectedWhen true, indicates that this user has chosen to protect their Tweets. See About Public and Protected Tweets . Example: true.
verifiedWhen true, indicates that the user has a verified account. See Verified Accounts . Example: false.
followers_countThe number of followers this account currently has. Under certain conditions of duress, this field will temporarily indicate “0”. Example: 21.
friends_countThe number of users this account is following (AKA their “followings”). Under certain conditions of duress, this field will temporarily indicate “0”. Example: 32.
listed_countThe number of public lists that this user is a member of. Example: 9274.
favourites_countThe number of Tweets this user has liked in the account’s lifetime. British spelling used in the field name for historical reasons. Example: 13.
statuses_countThe number of Tweets (including retweets) issued by the user. Example: 42.
created_atThe UTC datetime that the user account was created on Twitter. Example: "Mon Nov 29 21:18:15 +0000 2010".
profile_banner_urlThe HTTPS-based URL pointing to the standard web representation of the user’s uploaded profile banner. By adding a final path element of the URL, it is possible to obtain different image sizes optimized for specific displays. For size variants, please see User Profile Images and Banners .Example: "https://si0.twimg.com/profile_banners/819797/1348102824".
profile_image_url_httpsA HTTPS-based URL pointing to the user’s profile image. Example: "https://abs.twimg.com/sticky/default_profile_images/default_profile_normal.png".
default_profileWhen true, indicates that the user has not altered the theme or background of their user profile. Example: false.
default_profile_imageWhen true, indicates that the user has not uploaded their own profile image and a default image is used instead. Example: false.
withheld_in_countriesWhen present, indicates a list of uppercase two-letter country codes this content is withheld from. Twitter supports the following non-country values for this field:“XX” - Content is withheld in all countries “XY” - Content is withheld due to a DMCA request.Example: ["GR", "HK", "MY"].
withheld_scopeWhen present, indicates that the content being withheld is a “user.”Example: "user".
entities-
show_all_inline_media-
status-
email-

Specs

update_params() :: %{
  optional(:name) => binary(),
  optional(:url) => binary(),
  optional(:location) => binary(),
  optional(:description) => binary(),
  optional(:profile_link_color) => binary(),
  optional(:include_entities) => boolean(),
  optional(:skip_status) => boolean()
}

Parameters for update/3.

namedescription
nameFull name associated with the profile.
urlURL associated with the profile. Will be prepended with http:// if not present.
locationThe city or country describing where the user of the account is located. The contents are not normalized or geocoded in any way.
descriptionA description of the user owning the account.
profile_link_colorSets a hex value that controls the color scheme of links used on the authenticating user's profile page on twitter.com. This must be a valid hexadecimal value, and may be either three or six characters (ex: F00 or FF0000). This parameter replaces the deprecated (and separate) update_profile_colors API method.
include_entitiesThe entities node will not be included when set to false .
skip_statusWhen set to either true , t or 1 statuses will not be included in the returned user object.

See the Twitter API documentation for details.

Link to this type

update_profile_banner_params()

View Source

Specs

update_profile_banner_params() :: %{
  :banner => binary(),
  optional(:width) => binary(),
  optional(:height) => binary(),
  optional(:offset_left) => binary(),
  optional(:offset_top) => binary()
}

Parameters for update_profile_banner/3.

namedescription
bannerThe Base64-encoded or raw image data being uploaded as the user's new profile banner.
widthThe width of the preferred section of the image being uploaded in pixels. Use with height , offset_left , and offset_top to select the desired region of the image to use.
heightThe height of the preferred section of the image being uploaded in pixels. Use with width , offset_left , and offset_top to select the desired region of the image to use.
offset_leftThe number of pixels by which to offset the uploaded image from the left. Use with height , width , and offset_top to select the desired region of the image to use.
offset_topThe number of pixels by which to offset the uploaded image from the top. Use with height , width , and offset_left to select the desired region of the image to use.

See the Twitter API documentation for details.

Link to this type

update_profile_image_params()

View Source

Specs

update_profile_image_params() :: %{
  :image => binary(),
  optional(:include_entities) => boolean(),
  optional(:skip_status) => boolean()
}

Parameters for update_profile_image/3.

namedescription
imageThe avatar image for the profile, base64-encoded. Must be a valid GIF, JPG, or PNG image of less than 700 kilobytes in size. Images with width larger than 400 pixels will be scaled down. Animated GIFs will be converted to a static GIF of the first frame, removing the animation.
include_entitiesThe entities node will not be included when set to false .
skip_statusWhen set to either true , t or 1 statuses will not be included in the returned user objects.

See the Twitter API documentation for details.

Link to this type

update_setting_params()

View Source

Specs

update_setting_params() :: %{
  optional(:sleep_time_enabled) => boolean(),
  optional(:start_sleep_time) => integer(),
  optional(:end_sleep_time) => integer(),
  optional(:time_zone) => binary(),
  optional(:trend_location_woeid) => integer(),
  optional(:lang) => binary()
}

Parameters for update_setting/3.

namedescription
sleep_time_enabledWhen set to true , t or 1 , will enable sleep time for the user. Sleep time is the time when push or SMS notifications should not be sent to the user.
start_sleep_timeThe hour that sleep time should begin if it is enabled. The value for this parameter should be provided in ISO 8601 format (i.e. 00-23). The time is considered to be in the same timezone as the user's time_zone setting.
end_sleep_timeThe hour that sleep time should end if it is enabled. The value for this parameter should be provided in ISO 8601 format (i.e. 00-23). The time is considered to be in the same timezone as the user's time_zone setting.
time_zoneThe timezone dates and times should be displayed in for the user. The timezone must be one of the Rails TimeZone names.
trend_location_woeidThe Yahoo! Where On Earth ID to use as the user's default trend location. Global information is available by using 1 as the WOEID. The WOEID must be one of the locations returned by GET trends/available .
langThe language which Twitter should render in for this user. The language must be specified by the appropriate two letter ISO 639-1 representation. Currently supported languages are provided by this endpoint .

See the Twitter API documentation for details.

Link to this section Functions

Specs

decode!(map()) :: t()

Decode JSON-decoded map into t/0

Link to this function

delete_profile_banner(client)

View Source

Specs

delete_profile_banner(Tw.V1_1.Client.t()) ::
  {:ok, binary()} | {:error, Tw.V1_1.Client.error()}

Request POST /account/remove_profile_banner.json and return decoded result.

Removes the uploaded profile banner for the authenticating user. Returns HTTP 200 upon success.

See the Twitter API documentation for details.

Link to this function

get(client, params \\ %{})

View Source

Specs

get(Tw.V1_1.Client.t(), get_params()) ::
  {:ok, t()} | {:error, Tw.V1_1.Client.error()}

Request GET /account/verify_credentials.json and return decoded result.

Returns an HTTP 200 OK response code and a representation of the requesting user if authentication was successful; returns a 401 status code and an error message if not. Use this method to test if supplied user credentials are valid.

See the Twitter API documentation for details.

Specs

get_setting(Tw.V1_1.Client.t()) ::
  {:ok, setting()} | {:error, Tw.V1_1.Client.error()}

Request GET /account/settings.json and return decoded result.

Returns settings (including current trend, geo and sleep time information) for the authenticating user.

See the Twitter API documentation for details.

Specs

update(Tw.V1_1.Client.t(), update_params()) ::
  {:ok, t()} | {:error, Tw.V1_1.Client.error()}

Request POST /account/update_profile.json and return decoded result.

Sets some values that users are able to set under the "Account" tab of their settings page. Only the parameters specified will be updated.

See the Twitter API documentation for details.

Link to this function

update_profile_banner(client, params)

View Source

Specs

update_profile_banner(Tw.V1_1.Client.t(), update_profile_banner_params()) ::
  {:ok, binary()} | {:error, Tw.V1_1.Client.error()}

Request POST /account/update_profile_banner.json and return decoded result.

Uploads a profile banner on behalf of the authenticating user. More information about sizing variations can be found in User Profile Images and Banners and GET users / profile_banner.

Profile banner images are processed asynchronously. The profile_banner_url and its variant sizes will not necessary be available directly after upload.

See the Twitter API documentation for details.

Examples

iex> banner = File.read!("/tmp/new_banner.png") |> Base.encode64()
iex> Tw.V1_1.Me.update_profile_banner(client, %{banner: banner})
{:ok, ""}
Link to this function

update_profile_image(client, params)

View Source

Specs

update_profile_image(Tw.V1_1.Client.t(), update_profile_image_params()) ::
  {:ok, t()} | {:error, Tw.V1_1.Client.error()}

Request POST /account/update_profile_image.json and return decoded result.

Updates the authenticating user's profile image. Note that this method expects raw multipart data, not a URL to an image.

This method asynchronously processes the uploaded file before updating the user's profile image URL. You can either update your local cache the next time you request the user's information, or, at least 5 seconds after uploading the image, ask for the updated URL using GET users / show.

See the Twitter API documentation for details.

Examples

iex> image = File.read!("/tmp/new_profile_image.png") |> Base.encode64()
iex> Tw.V1_1.Me.update_profile_image(client, %{image: image})
{:ok, %Tw.V1_1.Me{}}
Link to this function

update_setting(client, params)

View Source

Specs

update_setting(Tw.V1_1.Client.t(), update_setting_params()) ::
  {:ok, setting()} | {:error, Tw.V1_1.Client.error()}

Request POST /account/settings.json and return decoded result.

Updates the authenticating user's settings.

See the Twitter API documentation for details.