Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public class TwitterRESTService
- Object
- ConnectionRequest
- TwitterRESTService
ImplementsIOProgressListener
Fields
public static final String METHOD_USER_TIMELINE = "statuses/user_timeline" | |
public static final String METHOD_TWEETS = "search/tweets" |
Constructors
public TwitterRESTService(String method) | The constructor accepts the method to invoke |
public TwitterRESTService(String method, boolean post) | The constructor accepts the method to invoke |
public TwitterRESTService(String method, String version, boolean post) | The constructor accepts the method to invoke |
Methods
public static String initToken(String consumerKey, String consumerSecret) | Logs in to twitter as an application |
public static void setToken(String token) | For every request twitter now needs an authorization token |
public boolean equals(Object o) | Indicates whether some other object is “equal to” this one. |
public int hashCode() | Returns a hash code value for the object. |
protected void readResponse(InputStream input)
throws IOException | Callback for the server response with the input stream from the server. |
public Hashtable<String, Object> getParseTree() | Returns the full Hashtable parse tree read from the server |
public int getStatusesCount() | Returns the number of statuses within the response |
public Hashtable<String, Object> getStatus(int offset) | Returns the status at the given offset |
public String getIdStr() | Gets the id string of the first entry which is important if we want to set the id to start with in the next request |
Inherited nested types
Inherited fields
Inherited methods
From ConnectionRequest
getDefaultCacheMode, setDefaultCacheMode, isReadResponseForErrorsDefault, setReadResponseForErrorsDefault, isHandleErrorCodesInGlobalErrorHandler, setHandleErrorCodesInGlobalErrorHandler, getCookieHeader, setCookieHeader, isCookiesEnabledDefault, setCookiesEnabledDefault, isDefaultFollowRedirects, setDefaultFollowRedirects, isReadTimeoutSupported, purgeCacheDirectory, getDefaultUserAgent, setDefaultUserAgent, setUseNativeCookieStore, isNativeCookieSharingSupported, fetchJSON, fetchJSONAsync, getCacheMode, setCacheMode, isCheckSSLCertificates, setCheckSSLCertificates, isInsecure, setInsecure, getResponseData, getHttpMethod, setHttpMethod, addRequestHeader, removeRequestHeader, removeRequestHeaderIfUnchanged, addRequestHeaderIfAbsent, getRequestHeader, shouldApplyDefaultHeaders, checkSSLCertificates, getReadTimeout, setReadTimeout, initConnection, getCachedData, purgeCache, cacheUnmodified, cookieReceived, cookieSent, initCookieHeader, getResponseCode, getResposeCode, shouldConvertPostToGetOnRedirect, readHeaders, readErrorCodeHeaders, getHeader, getHeaders, getHeaderFieldNames, getYield, shouldAutoCloseResponse, handleIOException, handleRuntimeException, handleException, canGetSSLCertificates, getSSLCertificates, handleErrorResponseCode, retry, onRedirect, postResponse, createRequestURL, buildRequestBody, shouldWriteUTFAsGetBytes, kill, shouldStop, isPausable, pause, resume, isPost, setPost, addArgument, removeArgument, removeAllArguments, addArgumentNoEncoding, addArgumentNoEncoding, addArgumentNoEncodingArray, addArgument, addArgumentArray, addArgument, addArguments, getContentType, setContentType, isWriteRequest, setWriteRequest, isReadRequest, setReadRequest, isPaused, setPaused, isKilled, setKilled, getPriority, setPriority, getUserAgent, setUserAgent, isFollowRedirects, setFollowRedirects, getTimeout, setTimeout, getContentLength, ioStreamUpdate, getUrl, setUrl, addResponseListener, removeResponseListener, addResponseCodeListener, addExceptionListener, removeResponseCodeListener, removeExceptionListener, hasResponseListeners, fireResponseListener, isDuplicateSupported, setDuplicateSupported, validate, getDisposeOnCompletion, setDisposeOnCompletion, getShowOnInit, setShowOnInit, getSilentRetryCount, setSilentRetryCount, isFailSilently, setFailSilently, isReadResponseForErrors, setReadResponseForErrors, getResponseContentType, isRedirecting, getDestinationFile, setDestinationFile, getDestinationStorage, setDestinationStorage, isCookiesEnabled, setCookiesEnabled, setChunkedStreamingMode, downloadImageToStorage, downloadImageToStorage, downloadImageToStorage, downloadImageToStorage, downloadImageToStorage, downloadImageToStorage, downloadImageToFileSystem, downloadImageToFileSystem, downloadImageToFileSystem, downloadImageToFileSystem, downloadImageToFileSystem, downloadImageToFileSystem, getRequestBody, setRequestBody, setRequestBody, getRequestBodyData, getResponseErrorMessage
Field details
METHOD_USER_TIMELINE
public static final String METHOD_USER_TIMELINE = "statuses/user_timeline"METHOD_TWEETS
public static final String METHOD_TWEETS = "search/tweets"Constructor details
TwitterRESTService
public TwitterRESTService(String method)Parameters
methodString- the api method to invoke e.g. “statuses/public_timeline”
TwitterRESTService
public TwitterRESTService(String method, boolean post)Parameters
methodString- the api method to invoke e.g. “statuses/public_timeline”
postboolean- true for post requests and false for get request
TwitterRESTService
public TwitterRESTService(String method, String version, boolean post)Parameters
methodString- the api method to invoke e.g. “statuses/public_timeline”
versionString- the API version to send e.g. “1”
postboolean- true for post requests and false for get request
Method details
initToken
public static String initToken(String consumerKey, String consumerSecret)Parameters
consumerKeyString- the key to login with
consumerSecretString- the secret to to login with
Returns
setToken
public static void setToken(String token)Parameters
tokenString- the token
equals
public boolean equals(Object o)hashCode
public int hashCode()readResponse
protected void readResponse(InputStream input)
throws IOExceptionParameters
inputInputStream- the input stream containing the response
Throws
IOException- when a read input occurs
getParseTree
public Hashtable<String, Object> getParseTree()Returns
getStatusesCount
public int getStatusesCount()Returns
getStatus
public Hashtable<String, Object> getStatus(int offset)Parameters
offsetint- the offset for the status
Returns
getIdStr
public String getIdStr()