View Source Tw.V1_1.Trend (Tw v0.1.1)

Struct for result of GET /trends/place.json and trend related functions.

See the Twitter API documentation for details.

Link to this section Summary

Types

Parameters for at/3.

Parameters for closest_locations/3.

t()

Functions

Request GET /trends/place.json and return decoded result.

Request GET /trends/available.json and return decoded result.

Request GET /trends/closest.json and return decoded result.

Decode JSON-decoded map into t/0

Link to this section Types

Specs

at_params() :: %{:id => integer(), optional(:exclude) => binary()}

Parameters for at/3.

namedescription
idThe numeric value that represents the location from where to return trending information for from. Formerly linked to the Yahoo! Where On Earth ID Global information is available by using 1 as the WOEID .
excludeSetting this equal to hashtags will remove all hashtags from the trends list.

See the Twitter API documentation for details.

Link to this type

closest_locations_params()

View Source

Specs

closest_locations_params() :: %{lat: binary(), long: binary()}

Parameters for closest_locations/3.

namedescription
latIf provided with a long parameter the available trend locations will be sorted by distance, nearest to furthest, to the co-ordinate pair. The valid ranges for longitude is -180.0 to +180.0 (West is negative, East is positive) inclusive.
longIf provided with a lat parameter the available trend locations will be sorted by distance, nearest to furthest, to the co-ordinate pair. The valid ranges for longitude is -180.0 to +180.0 (West is negative, East is positive) inclusive.

See the Twitter API documentation for details.

Specs

t() :: %Tw.V1_1.Trend{
  name: binary(),
  promoted_content: boolean() | nil,
  query: binary(),
  tweet_volume: integer() | nil,
  url: binary()
}

Link to this section Functions

Specs

at(Tw.V1_1.Client.t(), at_params()) ::
  {:ok,
   [
     %{
       trends: [t()],
       as_of: DateTime.t(),
       created_at: DateTime.t(),
       locations: [%{name: binary(), woeid: non_neg_integer()}]
     }
   ]}
  | {:error, Tw.V1_1.Client.error()}

Request GET /trends/place.json and return decoded result.

Returns the top 50 trending topics for a specific id, if trending information is available for it.

Note: The id parameter for this endpoint is the "where on earth identifier" or WOEID, which is a legacy identifier created by Yahoo and has been deprecated. Twitter API v1.1 still uses the numeric value to identify town and country trend locations. Reference our legacy blog post, or archived data

Example WOEID locations include: Worldwide: 1 UK: 23424975 Brazil: 23424768 Germany: 23424829 Mexico: 23424900 Canada: 23424775 United States: 23424977 New York: 2459115

To identify other ids, please use the GET trends/available endpoint.

The response is an array of trend objects that encode the name of the trending topic, the query parameter that can be used to search for the topic on Twitter Search, and the Twitter Search URL.

The most up to date info available is returned on request. The created_at field will show when the oldest trend started trending. The as_of field contains the timestamp when the list of trends was created.

The tweet_volume for the last 24 hours is also returned for many trends if this is available.

See the Twitter API documentation for details.

Link to this function

available_locations(client)

View Source

Specs

available_locations(Tw.V1_1.Client.t()) ::
  {:ok, [Tw.V1_1.TrendLocation.t()]} | {:error, Tw.V1_1.Client.error()}

Request GET /trends/available.json and return decoded result.

Returns the locations that Twitter has trending topic information for.

The response is an array of "locations" that encode the location's WOEID and some other human-readable information such as a canonical name and country the location belongs in.

Note: This endpoint uses the "where on earth identifier" or WOEID, which is a legacy identifier created by Yahoo and has been deprecated. Twitter API v1.1 still uses the numeric value to identify town and country trend locations. Reference our legacy blog post for more details. The url returned in the response, where.yahooapis.com is no longer valid.

See the Twitter API documentation for details.

Link to this function

closest_locations(client, params)

View Source

Specs

closest_locations(Tw.V1_1.Client.t(), closest_locations_params()) ::
  {:ok, [Tw.V1_1.TrendLocation.t()]} | {:error, Tw.V1_1.Client.error()}

Request GET /trends/closest.json and return decoded result.

Returns the locations that Twitter has trending topic information for, closest to a specified location.

The response is an array of "locations" that encode the location's WOEID and some other human-readable information such as a canonical name and country the location belongs in.

Note: The "where on earth identifier" or WOEID, is a legacy identifier created by Yahoo and has been deprecated. Twitter API v1.1 still uses the numeric value to identify town and country trend locations. Reference our legacy blog post, or archived data. The url returned in the response, where.yahooapis.com is no longer valid.

See the Twitter API documentation for details.

Specs

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

Decode JSON-decoded map into t/0