extwitter v0.9.2 ExTwitter

Provides access interfaces for the Twitter API.

Link to this section Summary

Functions

POST oauth/access_token

GET oauth/authenticate Returns the URL you should redirect the user to for twitter sign-in

GET oauth/authenticate Returns the URL you should redirect the user to for twitter sign-in

GET oauth/authorize

GET oauth/authorize Returns the URL you should redirect the user to for 3-legged authorization

POST blocks/create

Returns current OAuth configuration settings for accessing twitter server

Provides OAuth configuration settings for accessing twitter server

Provides OAuth configuration settings for accessing twitter server

POST favorites/create

POST direct_messages/destroy/:id

POST direct_messages/destroy/:id

POST favorites/destroy

POST statuses/destroy/:id

POST statuses/destroy/:id

GET direct_messages/show/:id

GET direct_messages

GET direct_messages

GET favorites/list

GET favorites/list

POST friendships/create

POST friendships/create

GET followers/ids

GET followers/ids

GET followers/list

GET followers/list

GET friends/ids

GET friends/ids

GET friends/list

GET friends/list

GET geo/search

GET statuses/home_timeline

GET statuses/home_timeline

GET lists/members

GET lists/members

GET lists/memberships

GET lists/memberships

GET lists/subscribers

GET lists/subscribers

GET lists/statuses

GET lists/statuses

GET lists/list

GET statuses/lookup

GET statuses/lookup

GET statuses/mentions_timeline

GET statuses/mentions_timeline

GET application/rate_limit_status

GET application/rate_limit_status

Provides general twitter API access interface

Provides general twitter API access interface

POST oauth/request_token

POST oauth/request_token

POST statuses/retweet/:id

POST statuses/retweet/:id

GET statuses/retweeters/ids

GET statuses/retweeters/ids

GET statuses/retweets/:id

GET statuses/retweets/:id

GET statuses/retweets_of_me

GET statuses/retweets_of_me

GET geo/reverse_geocode

GET geo/reverse_geocode

GET search/tweets

GET search/tweets

GET direct_messages/sent

GET direct_messages/sent

GET statuses/show/:id

GET statuses/show/:id

An interface to control the stream

An interface to control the stream

POST statuses/filter

POST statuses/filter

GET statuses/sample

GET statuses/sample

GET user

GET trends/place

GET trends/place

POST blocks/destroy

POST friendships/destroy

POST statuses/unretweet/:id

POST statuses/unretweet/:id

POST statuses/update

POST statuses/update

POST media/upload POST statuses/update

POST media/upload POST statuses/update

Chunk upload media and return media_id. POST media/upload (INIT) POST media/upload (APPEND) POST media/upload (FINALIZE)

GET users/show

GET users/lookup

GET users/profile_banner

GET users/search

GET users/search

GET statuses/user_timeline

GET statuses/user_timeline

GET account/verify_credentials

Link to this section Types

Link to this type stream_control_type()
stream_control_type() :: :stop

Link to this section Functions

Link to this function access_token(verifier, request_token)
access_token(String.t, String.t) ::
  {:ok, String.t} |
  {:error, String.t}

POST oauth/access_token

Examples

ExTwitter.access_token("OAUTH_VERIFIER", "ACCESS_TOKEN", "ACCESS_TOKEN_SECRET")

Reference

https://dev.twitter.com/oauth/reference/post/oauth/access_token https://dev.twitter.com/web/sign-in/implementing

Link to this function authenticate_url(oauth_token)
authenticate_url(String.t(Map.t)) ::
  {:ok, String.t} |
  {:error, String.t}
authenticate_url(String.t) ::
  {:ok, String.t} |
  {:error, String.t}

GET oauth/authenticate Returns the URL you should redirect the user to for twitter sign-in

Examples

token = ExTwitter.request_token
ExTwitter.authenticate_url(token.oauth_token)

Reference

https://dev.twitter.com/oauth/reference/get/oauth/authenticate https://dev.twitter.com/web/sign-in/implementing

Link to this function authenticate_url(oauth_token, options)

GET oauth/authenticate Returns the URL you should redirect the user to for twitter sign-in

Examples

token = ExTwitter.request_token
ExTwitter.authenticate_url(token.oauth_token, %{force_login: true})

Reference

https://dev.twitter.com/oauth/reference/get/oauth/authenticate https://dev.twitter.com/web/sign-in/implementing

Link to this function authorize_url(oauth_token)
authorize_url(String.t) :: {:ok, String.t} | {:error, String.t}

GET oauth/authorize

Examples

token = ExTwitter.request_token
ExTwitter.authorize_url(token.oauth_token)

Returns the URL you should redirect the user to for 3-legged authorization

Link to this function authorize_url(oauth_token, options)
authorize_url(String.t, Map.t) ::
  {:ok, String.t} |
  {:error, String.t}

GET oauth/authorize Returns the URL you should redirect the user to for 3-legged authorization

Examples

token = ExTwitter.request_token
ExTwitter.authorize_url(token.oauth_token, %{force_login: true})

Reference

https://dev.twitter.com/oauth/reference/get/oauth/authorize https://dev.twitter.com/oauth/3-legged https://dev.twitter.com/web/sign-in/implementing

POST blocks/create

Examples

ExTwitter.block("twitter")
ExTwitter.block(783214)

Reference

https://dev.twitter.com/rest/reference/post/blocks/create

Link to this function configure()
configure() :: Keyword.t | nil

Returns current OAuth configuration settings for accessing twitter server.

Link to this function configure(oauth)
configure(Keyword.t) :: :ok

Provides OAuth configuration settings for accessing twitter server.

The specified configuration applies globally. Use ExTwitter.configure/2 for setting different configurations on each processes.

Examples

ExTwitter.configure(
  consumer_key: System.get_env("TWITTER_CONSUMER_KEY"),
  consumer_secret: System.get_env("TWITTER_CONSUMER_SECRET"),
  access_token: System.get_env("TWITTER_ACCESS_TOKEN"),
  access_token_secret: System.get_env("TWITTER_ACCESS_SECRET")
)
Link to this function configure(scope, oauth)
configure(:global | :process, Keyword.t) :: :ok

Provides OAuth configuration settings for accessing twitter server.

Options

The scope can have one of the following values.

  • :global - configuration is shared for all processes.

  • :process - configuration is isolated for each process.

Examples

ExTwitter.configure(
  :process,
  consumer_key: System.get_env("TWITTER_CONSUMER_KEY"),
  consumer_secret: System.get_env("TWITTER_CONSUMER_SECRET"),
  access_token: System.get_env("TWITTER_ACCESS_TOKEN"),
  access_token_secret: System.get_env("TWITTER_ACCESS_SECRET")
)
Link to this function create_favorite(id, options)
create_favorite(Integer, Keyword.t) :: ExTwitter.Model.Tweet.t

POST favorites/create

Reference

https://dev.twitter.com/rest/reference/post/favorites/create

Link to this function destroy_direct_message(id)
destroy_direct_message(Integer) :: ExTwitter.Model.DirectMessage.t

POST direct_messages/destroy/:id

Examples

ExTwitter.destroy_direct_message(12345)

Reference

https://dev.twitter.com/rest/reference/post/direct_messages/destroy

Link to this function destroy_direct_message(id, options)
destroy_direct_message(Integer, Keyword.t) :: ExTwitter.Model.DirectMessage.t

POST direct_messages/destroy/:id

Examples

ExTwitter.destroy_direct_message(12345, include_entities: false)

Reference

https://dev.twitter.com/rest/reference/post/direct_messages/destroy

Link to this function destroy_favorite(id, options)
destroy_favorite(Integer, Keyword.t) :: ExTwitter.Model.Tweet.t

POST favorites/destroy

Reference

https://dev.twitter.com/rest/reference/post/favorites/destroy

Link to this function destroy_status(id)
destroy_status(Integer) :: ExTwitter.Model.Tweet.t

POST statuses/destroy/:id

Examples

ExTwitter.destroy_status(446328507694845952)

Reference

https://dev.twitter.com/rest/reference/post/statuses/destroy/:id

Link to this function destroy_status(id, options)
destroy_status(Integer, Keyword.t) :: ExTwitter.Model.Tweet.t

POST statuses/destroy/:id

Examples

ExTwitter.destroy_status(446328507694845952, trim_user: true)

Reference

https://dev.twitter.com/rest/reference/post/statuses/destroy/:id

Link to this function direct_message(id)
direct_message(Integer | String.t) :: ExTwitter.Model.DirectMessage.t

GET direct_messages/show/:id

Examples

ExTwitter.direct_message(446328507694845952)

Reference

https://dev.twitter.com/rest/reference/get/direct_messages/show

Link to this function direct_messages()
direct_messages() :: [ExTwitter.Model.DirectMessage.t]

GET direct_messages

Examples

ExTwitter.direct_messages

Reference

https://dev.twitter.com/rest/reference/get/direct_messages

Link to this function direct_messages(options)

GET direct_messages

Examples

ExTwitter.direct_messages(count: 1)

Reference

https://dev.twitter.com/rest/reference/get/direct_messages

GET favorites/list

Reference

https://dev.twitter.com/rest/reference/get/favorites/list

Link to this function favorites(options)

GET favorites/list

Examples

ExTwitter.favorites(screen_name: "twitter", count: 1)

Reference

https://dev.twitter.com/rest/reference/get/favorites/list

POST friendships/create

Examples

ExTwitter.follow("twitter")
ExTwitter.follow(783214)

Reference

https://dev.twitter.com/rest/reference/post/friendships/create

Link to this function follow(id, options)
follow(String.t | Integer, Keyword.t) :: ExTwitter.Model.User.t

POST friendships/create

Examples

ExTwitter.follow("twitter", follow: true)
ExTwitter.follow(783214, follow: true)

Reference

https://dev.twitter.com/rest/reference/post/friendships/create

Link to this function follower_ids(id_or_options)
follower_ids(String.t | Integer | Keyword.t) :: ExTwitter.Model.Cursor.t

GET followers/ids

Specify one of the screen_name, user_id or options in the argument.

Examples

ExTwitter.follower_ids("twitter")
ExTwitter.follower_ids(783214)
ExTwitter.follower_ids(count: 1)

Reference

https://dev.twitter.com/rest/reference/get/followers/ids

Link to this function follower_ids(id, options)
follower_ids(String.t | Integer, Keyword.t) :: ExTwitter.Model.Cursor.t

GET followers/ids

Examples

ExTwitter.follower_ids("twitter", count: 1)
ExTwitter.follower_ids(783214, count: 1)

Reference

https://dev.twitter.com/rest/reference/get/followers/ids

Link to this function followers(id_or_options)
followers(String.t | Integer | Keyword.t) :: ExTwitter.Model.Cursor.t

GET followers/list

Specify one of the screen_name, user_id or options in the argument.

Examples

ExTwitter.followers("twitter")
ExTwitter.followers(783214)
ExTwitter.followers(count: 1)

Reference

https://dev.twitter.com/rest/reference/get/followers/list

Link to this function followers(id, options)
followers(String.t | Integer, Keyword.t) :: ExTwitter.Model.Cursor.t

GET followers/list

Examples

ExTwitter.followers("twitter", count: 1)
ExTwitter.followers(783214, count: 1)

Reference

https://dev.twitter.com/rest/reference/get/followers/list

Link to this function friend_ids(id_or_options)
friend_ids(String.t | Integer | Keyword.t) :: ExTwitter.Model.Cursor.t

GET friends/ids

Specify one of the screen_name, user_id or options in the argument.

Examples

ExTwitter.friend_ids("twitter")
ExTwitter.friend_ids(783214)
ExTwitter.friend_ids(count: 1)

Reference

https://dev.twitter.com/rest/reference/get/friends/ids

Link to this function friend_ids(id, options)
friend_ids(String.t | Integer, Keyword.t) :: ExTwitter.Model.Cursor.t

GET friends/ids

Examples

ExTwitter.friend_ids("twitter", count: 1)
ExTwitter.friend_ids(783214, count: 1)

Reference

https://dev.twitter.com/rest/reference/get/friends/ids

Link to this function friends(id_or_options)
friends(String.t | Integer | Keyword.t) :: ExTwitter.Model.Cursor.t

GET friends/list

Specify one of the screen_name, user_id or options in the argument.

Examples

ExTwitter.friends("twitter")
ExTwitter.friends(783214)
ExTwitter.friends(count: 1)

Reference

https://dev.twitter.com/rest/reference/get/friends/list

Link to this function friends(id, options)

GET friends/list

Examples

ExTwitter.friends("twitter", count: 1)
ExTwitter.friends(783214, count: 1)

Reference

https://dev.twitter.com/rest/reference/get/friends/list

Link to this function geo_search(query)

GET geo/search

Examples

ExTwitter.geo_search("new york")

Reference

https://dev.twitter.com/rest/reference/get/geo/search

Link to this function geo_search(query, options)

GET geo/search

Examples

ExTwitter.geo_search("new york", max_results: 1)

Reference

https://dev.twitter.com/rest/reference/get/geo/search

Link to this function home_timeline()
home_timeline() :: [ExTwitter.Model.Tweet.t]

GET statuses/home_timeline

Reference

https://dev.twitter.com/rest/reference/get/statuses/home_timeline

Link to this function home_timeline(options)
home_timeline(Keyword.t) :: [ExTwitter.Model.Tweet.t]

GET statuses/home_timeline

Examples

ExTwitter.home_timeline(count: 1)

Reference

https://dev.twitter.com/rest/reference/get/statuses/home_timeline

Link to this function list_members(options)
list_members(Keyword.t) :: [ExTwitter.Model.User.t]

GET lists/members

Examples

ExTwitter.list_members(slug: "twitter-engineering", owner_screen_name: "twitter")

Reference

https://dev.twitter.com/rest/reference/get/lists/members

Link to this function list_members(list, owner)

GET lists/members

Examples

ExTwitter.list_members("twitter-engineering", "twitter")

Reference

https://dev.twitter.com/rest/reference/get/lists/members

Link to this function list_members(list, owner, options)

GET lists/members

Examples

ExTwitter.list_members("twitter-engineering", "twitter", count: 1)

Reference

https://dev.twitter.com/rest/reference/get/lists/members

Link to this function list_memberships()
list_memberships() :: [ExTwitter.Model.List.t]

GET lists/memberships

Reference

https://dev.twitter.com/rest/reference/get/lists/memberships

Link to this function list_memberships(options)
list_memberships(Keyword.t) :: [ExTwitter.Model.List.t]

GET lists/memberships

Examples

ExTwitter.list_memberships(screen_name: "twitter", count: 2)

Reference

https://dev.twitter.com/rest/reference/get/lists/memberships

Link to this function list_subscribers(options)
list_subscribers(Keyword.t) :: [ExTwitter.Model.User.t]

GET lists/subscribers

Examples

ExTwitter.list_subscribers(slug: "twitter-engineering", owner_screen_name: "twitter")

Reference

https://dev.twitter.com/rest/reference/get/lists/subscribers

Link to this function list_subscribers(list, owner)
list_subscribers(String.t, String.t) :: [ExTwitter.Model.User.t]

GET lists/subscribers

Examples

ExTwitter.list_subscribers("twitter-engineering", "twitter")

Reference

https://dev.twitter.com/rest/reference/get/lists/subscribers

Link to this function list_subscribers(list, owner, options)

GET lists/subscribers

Examples

ExTwitter.list_subscribers("twitter-engineering", "twitter", count: 1)

Reference

https://dev.twitter.com/rest/reference/get/lists/subscribers

Link to this function list_timeline(options)
list_timeline(Keyword.t) :: [ExTwitter.Model.Tweet.t]

GET lists/statuses

Examples

ExTwitter.list_timeline(slug: "twitter-engineering", owner_screen_name: "twitter")

Reference

https://dev.twitter.com/rest/reference/get/lists/statuses

Link to this function list_timeline(list, owner)

GET lists/statuses

Examples

ExTwitter.list_timeline("twitter-engineering", "twitter")

Reference

https://dev.twitter.com/rest/reference/get/lists/statuses

Link to this function list_timeline(list, owner, options)

GET lists/statuses

Examples

ExTwitter.list_timeline("twitter-engineering", "twitter", count: 1)

Reference

https://dev.twitter.com/rest/reference/get/lists/statuses

Link to this function lists(id_or_screen_name)
lists(String.t | Integer) :: [ExTwitter.Model.List.t]

GET lists/list

Examples

ExTwitter.lists("twitter")
ExTwitter.lists(783214)

Reference

https://dev.twitter.com/rest/reference/get/lists/list

Link to this function lists(id_or_screen_name, options)
lists(String.t | Integer, Keyword.t) :: [ExTwitter.Model.List.t]

GET lists/list

Examples

ExTwitter.lists("twitter", count: 1)
ExTwitter.lists(783214, count: 1)

Reference

https://dev.twitter.com/rest/reference/get/lists/list

Link to this function lookup_status(id)
lookup_status(String.t) :: [ExTwitter.Model.Tweet.t]

GET statuses/lookup

Examples

ExTwitter.lookup_status("504692034473435136,502883389347622912")

Reference

https://dev.twitter.com/rest/reference/get/statuses/lookup

Link to this function lookup_status(id, options)

GET statuses/lookup

Examples

ExTwitter.lookup_status("504692034473435136,502883389347622912", trim_user: true)

Reference

https://dev.twitter.com/rest/reference/get/statuses/lookup

Link to this function mentions_timeline()
mentions_timeline() :: [ExTwitter.Model.Tweet.t]

GET statuses/mentions_timeline

Reference

https://dev.twitter.com/rest/reference/get/statuses/mentions_timeline

Link to this function mentions_timeline(options)
mentions_timeline(Keyword.t) :: [ExTwitter.Model.Tweet.t]

GET statuses/mentions_timeline

Examples

ExTwitter.mentions_timeline(count: 1)

Reference

https://dev.twitter.com/rest/reference/get/statuses/mentions_timeline

Link to this function new_direct_message(id_or_screen_name, text)
new_direct_message(String.t | Integer, String.t) :: ExTwitter.Model.DirectMessage.t

POST direct_messages/new

Specify one of the screen name, or user id in first argument.

Examples

ExTwitter.new_direct_message("twitter", "Message text")

Reference

https://dev.twitter.com/rest/reference/post/direct_messages/new

Link to this function rate_limit_status()
rate_limit_status() :: Map

GET application/rate_limit_status

Examples

status = ExTwitter.rate_limit_status
limit = status["resources"]["statuses"]["/statuses/home_timeline"]["remaining"]

Reference

https://dev.twitter.com/rest/reference/get/application/rate_limit_status

Link to this function rate_limit_status(options)
rate_limit_status(Keyword.t) :: Map

GET application/rate_limit_status

Examples

ExTwitter.rate_limit_status(resources: "statuses")

Reference

https://dev.twitter.com/rest/reference/get/application/rate_limit_status

Link to this function request(method, path)
request(:get | :post, String.t) :: Map

Provides general twitter API access interface.

This method simply returns parsed json in Map structure.

Examples

ExTwitter.request(:get, "1.1/statuses/home_timeline.json")
Link to this function request(method, path, params)
request(:get | :post, String.t, Keyword.t) :: Map

Provides general twitter API access interface.

This method simply returns parsed json in Map structure.

Examples

ExTwitter.request(:get, "1.1/search/tweets.json", [q: "elixir", count: 1])
Link to this function request_token()
request_token() :: [ExTwitter.Model.RequestToken.t]

POST oauth/request_token

Examples

ExTwitter.request_token

Reference

https://dev.twitter.com/oauth/reference/post/oauth/request_token https://dev.twitter.com/web/sign-in/implementing

Link to this function request_token(redirect_url)

POST oauth/request_token

Examples

ExTwitter.request_token("http://myapp.com/twitter-callback")

Reference

https://dev.twitter.com/oauth/reference/post/oauth/request_token https://dev.twitter.com/web/sign-in/implementing

Link to this function retweet(id)
retweet(Integer) :: ExTwitter.Model.Tweet.t

POST statuses/retweet/:id

Examples

ExTwitter.retweet(589095997340405760)

Reference

https://dev.twitter.com/rest/reference/post/statuses/retweet/:id

Link to this function retweet(id, options)
retweet(Integer, Keyword.t) :: ExTwitter.Model.Tweet.t

POST statuses/retweet/:id

Examples

ExTwitter.retweet(589095997340405760, trim_user: true)

Reference

https://dev.twitter.com/rest/reference/post/statuses/retweet/:id

Link to this function retweeter_ids(id)
retweeter_ids(Integer | String.t) :: [Integer | String.t]

GET statuses/retweeters/ids

Examples

ExTwitter.retweeter_ids(444144169058308096)

Reference

https://dev.twitter.com/rest/reference/get/statuses/retweeters/ids

Link to this function retweeter_ids(id, options)
retweeter_ids(Integer | String.t, Keyword.t) :: [Integer | String.t]

GET statuses/retweeters/ids

Examples

ExTwitter.retweeter_ids(444144169058308096, stringify_ids: true)

Reference

https://dev.twitter.com/rest/reference/get/statuses/retweeters/ids

Link to this function retweets(id)
retweets(Integer | String.t) :: [ExTwitter.Model.Tweet.t]

GET statuses/retweets/:id

Examples

ExTwitter.retweets(444144169058308096)

Reference

https://dev.twitter.com/rest/reference/get/statuses/retweets/:id

Link to this function retweets(id, options)
retweets(Integer | String.t, Keyword.t) :: [ExTwitter.Model.Tweet.t]

GET statuses/retweets/:id

Examples

ExTwitter.retweets(444144169058308096, count: 1)

Reference

https://dev.twitter.com/rest/reference/get/statuses/retweets/:id

Link to this function retweets_of_me()
retweets_of_me() :: [ExTwitter.Model.Tweet.t]

GET statuses/retweets_of_me

Reference

https://dev.twitter.com/rest/reference/get/statuses/retweets_of_me

Link to this function retweets_of_me(options)
retweets_of_me(Keyword.t) :: [ExTwitter.Model.Tweet.t]

GET statuses/retweets_of_me

Examples

ExTwitter.retweets_of_me(count: 1)

Reference

https://dev.twitter.com/rest/reference/get/statuses/retweets_of_me

Link to this function reverse_geocode(lat, long)
reverse_geocode(float, float) :: [ExTwitter.Model.Place.t]

GET geo/reverse_geocode

Examples

ExTwitter.reverse_geocode(37.7821120598956, -122.400612831116)

Reference

https://dev.twitter.com/rest/reference/get/geo/reverse_geocode

Link to this function reverse_geocode(lat, long, options)
reverse_geocode(float, float, Keyword.t) :: [ExTwitter.Model.Place.t]

GET geo/reverse_geocode

Examples

ExTwitter.reverse_geocode(37.7821120598956, -122.400612831116, max_results: 1)

Reference

https://dev.twitter.com/rest/reference/get/geo/reverse_geocode

GET search/tweets

Examples

ExTwitter.search("test")

Reference

https://dev.twitter.com/rest/reference/get/search/tweets

Link to this function search(query, options)
search(String.t, Keyword.t) ::
  [ExTwitter.Model.Tweet.t] |
  ExTwitter.Model.SearchResponse

GET search/tweets

Examples

ExTwitter.search("test", count: 1)

Reference

https://dev.twitter.com/rest/reference/get/search/tweets

Link to this function search_next_page(search_result)
search_next_page(String.t) :: [Map]

GET search/tweets

Examples

response = ExTwitter.search("pizza", [count: 100, search_metadata: true])
ExTwitter.search_next_page(response.metadata)

Reference

https://dev.twitter.com/rest/reference/get/search/tweets

Link to this function sent_direct_messages()
sent_direct_messages() :: [ExTwitter.Model.DirectMessage.t]

GET direct_messages/sent

Examples

ExTwitter.sent_direct_messages

Reference

https://dev.twitter.com/rest/reference/get/direct_messages/sent

Link to this function sent_direct_messages(options)
sent_direct_messages(Keyword.t) :: [ExTwitter.Model.DirectMessage.t]

GET direct_messages/sent

Examples

ExTwitter.sent_direct_messages(count: 1)

Reference

https://dev.twitter.com/rest/reference/get/direct_messages/sent

GET statuses/show/:id

Examples

ExTwitter.show(446328507694845952)

Reference

https://dev.twitter.com/rest/reference/get/statuses/show/:id

GET statuses/show/:id

Examples

ExTwitter.show(446328507694845952, trim_user: true)

Reference

https://dev.twitter.com/rest/reference/get/statuses/show/:id

Link to this function stream_control(pid, stream_control_type)
stream_control(pid, stream_control_type) :: :ok

An interface to control the stream.

This method is for controlling stream, and it doesn’t make twitter API call.

Options

The pid is the process id where stream is being processed.

Examples

ExTwitter.stream_control(pid, :stop)
Link to this function stream_control(pid, stream_control_type, options)
stream_control(pid, stream_control_type, [{:timeout, Integer}]) :: :ok

An interface to control the stream.

This method is for handling elixir’s stream which can keep running infinitely. It doesn’t make twitter API call.

Options

The options can have following values, in addition to the twitter API’s parameter.

  • :receive_messages - true/false flag whether to receive control messages in addition to normal tweets. default is false.

The pid is the process id where stream is processed.

The timeout is the maximum wait time (in milliseconds) to complete the message handling.

Examples

ExTwitter.stream_control(pid, :stop, timeout: 50)
Link to this function stream_filter(options)
stream_filter(Keyword.t) :: Enumerable.t

POST statuses/filter

Returns public statuses that match one or more filter predicates. This method returns the Stream that holds the list of tweets. Specify at least one of the [follow, track, locations] options.

Options

The options can have following values, in addition to the twitter API’s parameter.

  • :receive_messages - true/false flag whether to receive control messages in addition to normal tweets. default is false.

Examples

ExTwitter.stream_filter(track: "apple")

Reference

https://dev.twitter.com/streaming/reference/post/statuses/filter

Link to this function stream_filter(options, timeout)
stream_filter(Keyword.t, timeout) :: Enumerable.t

POST statuses/filter

Returns public statuses that match one or more filter predicates. This method returns the Stream that holds the list of tweets. Specify at least one of the [follow, track, locations] options.

Options

The options can have following values, in addition to the twitter API’s parameter.

  • :receive_messages - true/false flag whether to receive control messages in addition to normal tweets. default is false.

The timeout is the maximum milliseconds to wait until receiving next tweet. Specifying :infinity makes it wait infinitely.

Examples

ExTwitter.stream_filter([track: "apple"], 60000)

Reference

https://dev.twitter.com/streaming/reference/post/statuses/filter

Link to this function stream_sample()
stream_sample() :: Enumerable.t

GET statuses/sample

Returns a small random sample of all public statuses. This method returns the Stream that holds the list of tweets.

Reference

https://dev.twitter.com/streaming/reference/get/statuses/sample

Link to this function stream_sample(options)
stream_sample(Keyword.t) :: Enumerable.t

GET statuses/sample

Returns a small random sample of all public statuses. This method returns the Stream that holds the list of tweets.

Options

The options can have following values, in addition to the twitter API’s parameter.

  • :receive_messages - true/false flag whether to receive control messages in addition to normal tweets. default is false.

Reference

https://dev.twitter.com/streaming/reference/get/statuses/sample

Link to this function stream_user()
stream_user() :: Enumerable.t

GET user

Returns timeline streaming for a user. This method returns the stream that holds the list of tweets.

Examples

ExTwitter.stream_user

Reference

https://dev.twitter.com/streaming/reference/get/user

Link to this function stream_user(options, timeout)
stream_user(Keyword.t, Integer) :: Enumerable.t

See ExTwitter.API.Streaming.stream_user/2.

Link to this function trends(id)
trends(Integer | String.t) :: [ExTwitter.Model.Trend.t]

GET trends/place

Examples

ExTwitter.trends(1)

Reference

https://dev.twitter.com/rest/reference/get/trends/place

Link to this function trends(id, options)
trends(Integer | String.t, Keyword.t) :: [ExTwitter.Model.Trend.t]

GET trends/place

Examples

ExTwitter.trends(1, exclude: true)

Reference

https://dev.twitter.com/rest/reference/get/trends/place

Link to this function unblock(id)
unblock(String.t | Integer) :: ExTwitter.Model.User.t

POST blocks/destroy

Examples

ExTwitter.unblock("twitter")
ExTwitter.unblock(783214)

Reference

https://dev.twitter.com/rest/reference/post/blocks/destroy

Link to this function unfollow(id)
unfollow(String.t | Integer) :: ExTwitter.Model.User.t

POST friendships/destroy

Examples

ExTwitter.unfollow("twitter")
ExTwitter.unfollow(783214)

Reference

https://dev.twitter.com/rest/reference/post/friendships/destroy

Link to this function unretweet(id)
unretweet(Integer) :: ExTwitter.Model.Tweet.t

POST statuses/unretweet/:id

Examples

ExTwitter.unretweet(589095997340405760)

Reference

https://dev.twitter.com/rest/reference/post/statuses/unretweet/:id

Link to this function unretweet(id, options)
unretweet(Integer, Keyword.t) :: ExTwitter.Model.Tweet.t

POST statuses/unretweet/:id

Examples

ExTwitter.unretweet(589095997340405760, trim_user: true)

Reference

https://dev.twitter.com/rest/reference/post/statuses/unretweet/:id

POST statuses/update

Examples

ExTwitter.update("update sample")

Reference

https://dev.twitter.com/rest/reference/post/statuses/update

POST statuses/update

Examples

ExTwitter.update("update sample", trim_user: true)

Reference

https://dev.twitter.com/rest/reference/post/statuses/update

Link to this function update_with_media(status, media_content)
update_with_media(String.t, Keyword.t) :: ExTwitter.Model.Tweet.t

POST media/upload POST statuses/update

Examples

image = File.read!("fixture/images/sample.png")
ExTwitter.update_with_media("tweet with media", image)

Reference

https://dev.twitter.com/rest/reference/post/media/upload https://dev.twitter.com/rest/media/uploading-media

Note

This API works only for images at the moment. (Video files which requires chunked upload is not supported yet).

Link to this function update_with_media(status, media_content, options)

POST media/upload POST statuses/update

Examples

image = File.read!("fixture/images/sample.png")
ExTwitter.update_with_media("tweet with media", image, trim_user: true)

Reference

https://dev.twitter.com/rest/reference/post/media/upload https://dev.twitter.com/rest/media/uploading-media

Note

This API works only for images at the moment. (Video files which requires chunked upload is not supported yet).

Link to this function upload_media(path, content_type)
upload_media(String.t, String.t) :: integer

Chunk upload media and return media_id. POST media/upload (INIT) POST media/upload (APPEND) POST media/upload (FINALIZE)

## Examples media_id = upload_media(“/tmp/image.png”, “image/png”) //chunk size defaults to 65536 media_id = upload_media(“/tmp/image.png”, “image/png”, 32768)

Link to this function upload_media(path, content_type, chunk_size)
upload_media(String.t, String.t, integer) :: integer

See ExTwitter.API.Base.upload_media/3.

Link to this function user(id_or_screen_name)
user(String.t | Integer) :: ExTwitter.Model.User.t

GET users/show

Examples

ExTwitter.user("elixirlang")
ExTwitter.user(507309896)

Reference

https://dev.twitter.com/rest/reference/get/users/show

Link to this function user(id_or_screen_name, options)

GET users/show

Examples

ExTwitter.user("elixirlang", include_entities: false)
ExTwitter.user(507309896, include_entities: false)

Reference

https://dev.twitter.com/rest/reference/get/users/show

Link to this function user_lookup(id_or_options)
user_lookup(String.t | Integer | Keyword.t) :: [ExTwitter.Model.User.t]

GET users/lookup

Examples

ExTwitter.user_lookup("twitter")
ExTwitter.user_lookup(783214)
ExTwitter.user_lookup(screen_name: "twitter")

Reference

https://dev.twitter.com/rest/reference/get/users/lookup

Link to this function user_lookup(id_or_screen_name_list, options)
user_lookup([String.t | Integer] | String.t | Integer.t, Keyword.t) :: [ExTwitter.Model.User.t]

GET users/lookup

Examples

ExTwitter.user_lookup("twitter", include_entities: false)
ExTwitter.user_lookup(783214, include_entities: false)
ExTwitter.user_lookup(["twitter", "josevalim"], include_entities: false)
ExTwitter.user_lookup([783214, 10230812], include_entities: false)

Reference

https://dev.twitter.com/rest/reference/get/users/lookup

Link to this function user_profile_banner(id_or_screen_name)
user_profile_banner(String.t | Integer) :: ExTwitter.Model.ProfileBanner.t

GET users/profile_banner

Examples

ExTwitter.user_profile_banner(783214)
ExTwitter.user_profile_banner("twitter")

Reference

https://dev.twitter.com/rest/reference/get/users/profile_banner

Link to this function user_search(query)
user_search(String.t) :: [ExTwitter.Model.User.t]

GET users/search

Examples

ExTwitter.user_search("elixirlang")

Reference

https://dev.twitter.com/rest/reference/get/users/search

Link to this function user_search(query, options)

GET users/search

Examples

ExTwitter.user_search("elixirlang", count: 1)

Reference

https://dev.twitter.com/rest/reference/get/users/search

Link to this function user_timeline()
user_timeline() :: [ExTwitter.Model.Tweet.t]

GET statuses/user_timeline

Reference

https://dev.twitter.com/rest/reference/get/statuses/user_timeline

Link to this function user_timeline(options)
user_timeline(Keyword.t) :: [ExTwitter.Model.Tweet.t]

GET statuses/user_timeline

Examples

ExTwitter.user_timeline(count: 1)
ExTwitter.user_timeline([screen_name: "josevalim", count: 12])

Reference

https://dev.twitter.com/rest/reference/get/statuses/user_timeline

Link to this function verify_credentials()
verify_credentials() :: ExTwitter.Model.User.t

GET account/verify_credentials

Examples

ExTwitter.verify_credentials
ExTwitter.verify_credentials(include_email: true)

Reference

https://dev.twitter.com/rest/reference/get/account/verify_credentials