Class TwitterProvider

java.lang.Object
com.northconcepts.datapipeline.twitter.TwitterProvider

public class TwitterProvider extends Object
Non-streaming Twitter service provider.
  • Field Details

    • consumerKey

      protected final String consumerKey
    • consumerSecret

      protected final String consumerSecret
    • accessToken

      protected final String accessToken
    • accessTokenSecret

      protected final String accessTokenSecret
  • Constructor Details

    • TwitterProvider

      public TwitterProvider(String consumerKey, String consumerSecret)
      Creates a provider that uses application-only (OAuth 2 bearer token) authentication.
    • TwitterProvider

      public TwitterProvider(String consumerKey, String consumerSecret, String accessToken, String accessTokenSecret)
      Creates a provider that authenticates with the given user access token, or application-only if it is empty.
  • Method Details

    • getConfig

      public ConfigurationBuilder getConfig()
      Returns the twitter4j configuration used to create the client; changes after the first API call have no effect.
    • getHttpProxyHost

      public String getHttpProxyHost()
      Returns the HTTP proxy host, applied when the client is created on the first API call.
    • setHttpProxyHost

      public TwitterProvider setHttpProxyHost(String httpProxyHost)
      Sets the HTTP proxy host, applied when the client is created on the first API call.
    • getHttpProxyPort

      public Integer getHttpProxyPort()
      Returns the HTTP proxy port, applied when the client is created on the first API call.
    • setHttpProxyPort

      public TwitterProvider setHttpProxyPort(Integer httpProxyPort)
      Sets the HTTP proxy port, applied when the client is created on the first API call.
    • getTwitter

      protected Twitter getTwitter()
    • mute

      public void mute(String userScreenName)
    • getRateLimit

      public TwitterRateLimit getRateLimit(String rateLimitResource, String rateLimitKey)
      Calls the API for the current rate limit of the endpoint identified by resource family and key.
    • addExceptionProperties

      public DataException addExceptionProperties(DataException exception)
      Returns the exception unchanged; subclasses can override to add provider details.