public interface UsersResources
Modifier and Type | Method and Description |
---|---|
User |
createBlock(long userId)
Blocks the user specified in the ID parameter as the authenticating user.
|
User |
createBlock(String screenName)
Blocks the user specified in the ID parameter as the authenticating user.
|
User |
createMute(long userId)
Mutes the user specified in the ID parameter as the authenticating user.
|
User |
createMute(String screenName)
Mutes the user specified in the screen name parameter as the authenticating user.
|
User |
destroyBlock(long userId)
Un-blocks the user specified in the ID parameter as the authenticating user.
|
User |
destroyBlock(String screen_name)
Un-blocks the user specified in the ID parameter as the authenticating user.
|
User |
destroyMute(long userId)
Un-mutes the user specified in the ID parameter as the authenticating user.
|
User |
destroyMute(String screenName)
Un-mutes the user specified in the screen name parameter as the authenticating user.
|
AccountSettings |
getAccountSettings()
Returns the current trend, geo, language, timezone and sleep time information for the authenticating user.
|
IDs |
getBlocksIDs()
Returns an array of numeric user ids the authenticating user is blocking.
|
IDs |
getBlocksIDs(long cursor)
Returns an array of numeric user ids the authenticating user is blocking.
|
PagableResponseList<User> |
getBlocksList()
Returns a list of user objects that the authenticating user is blocking.
|
PagableResponseList<User> |
getBlocksList(long cursor)
Returns a list of user objects that the authenticating user is blocking.
|
ResponseList<User> |
getContributees(long userId)
Returns an array of users that the specified user can contribute to.
|
ResponseList<User> |
getContributees(String screenName)
Returns an array of users that the specified user can contribute to.
|
ResponseList<User> |
getContributors(long userId)
Returns an array of users who can contribute to the specified account.
|
ResponseList<User> |
getContributors(String screenName)
Returns an array of users who can contribute to the specified account.
|
IDs |
getMutesIDs(long cursor)
Returns an array of numeric user ids the authenticating user is muting.
|
PagableResponseList<User> |
getMutesList(long cursor)
Returns a list of user objects that the authenticating user is muting.
|
ResponseList<User> |
lookupUsers(long... ids)
Return up to 100 users worth of extended information, specified by either ID, screen name, or combination of the two.
|
ResponseList<User> |
lookupUsers(String... screenNames)
Return up to 100 users worth of extended information, specified by either ID, screen name, or combination of the two.
|
void |
removeProfileBanner()
Removes the uploaded profile banner for the authenticating user.
|
ResponseList<User> |
searchUsers(String query,
int page)
Run a search for users similar to the Find People button on Twitter.com; the same results returned by people search on Twitter.com will be returned by using this API.
Usage note: It is only possible to retrieve the first 1000 matches from this API. |
User |
showUser(long userId)
Returns extended information of a given user, specified by ID or screen name as per the required id parameter.
|
User |
showUser(String screenName)
Returns extended information of a given user, specified by ID or screen name as per the required id parameter.
|
AccountSettings |
updateAccountSettings(Integer trendLocationWoeid,
Boolean sleepTimeEnabled,
String startSleepTime,
String endSleepTime,
String timeZone,
String lang)
Updates the current trend, geo, language, timezone and sleep time information for the authenticating user.
|
AccountSettings |
updateAllowDmsFrom(String allowDmsFrom)
Updates the allowDmsFrom settings for the authenticating user.
|
User |
updateProfile(String name,
String url,
String location,
String description)
Sets values that users are able to set under the "Account" tab of their settings page.
|
User |
updateProfileBackgroundImage(File image,
boolean tile)
Deprecated.
Since Twitter4J 4.0.7
|
User |
updateProfileBackgroundImage(InputStream image,
boolean tile)
Updates the authenticating user's profile background image.
|
void |
updateProfileBanner(File image)
Uploads a profile banner on behalf of the authenticating user.
|
void |
updateProfileBanner(InputStream image)
Uploads a profile banner on behalf of the authenticating user.
|
User |
updateProfileColors(String profileBackgroundColor,
String profileTextColor,
String profileLinkColor,
String profileSidebarFillColor,
String profileSidebarBorderColor)
Deprecated.
Since Twitter4J 4.0.5
|
User |
updateProfileImage(File image)
Updates the authenticating user's profile image.
|
User |
updateProfileImage(InputStream image)
Updates the authenticating user's profile image.
|
User |
verifyCredentials()
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.
|
AccountSettings getAccountSettings() throws TwitterException
TwitterException
- when Twitter service or network is unavailableUser verifyCredentials() throws TwitterException
TwitterException
- when Twitter service or network is unavailable, or if supplied credential is wrong (TwitterException.getStatusCode() == 401)AccountSettings updateAccountSettings(Integer trendLocationWoeid, Boolean sleepTimeEnabled, String startSleepTime, String endSleepTime, String timeZone, String lang) throws TwitterException
trendLocationWoeid
- Optional. The Yahoo! Where On Earth ID to use as the user's default trend location.sleepTimeEnabled
- Optional. Whether sleep time is enabled for the userstartSleepTime
- Optional. The hour that sleep time should begin if it is enabled.endSleepTime
- Optional. The hour that sleep time should end if it is enabled.timeZone
- Optional. The timezone dates and times should be displayed in for the user.lang
- Optional. The language which Twitter should render in for this user. (two letter ISO 639-1)TwitterException
- when Twitter service or network is unavailableAccountSettings updateAllowDmsFrom(String allowDmsFrom) throws TwitterException
allowDmsFrom
- Optional. "all" for anyone, "followers" for friends onlyTwitterException
- when Twitter service or network is unavailableUser updateProfile(String name, String url, String location, String description) throws TwitterException
name
- Optional. Maximum of 20 characters.url
- Optional. Maximum of 100 characters. Will be prepended with "http://" if not present.location
- Optional. Maximum of 30 characters. The contents are not normalized or geocoded in any way.description
- Optional. Maximum of 160 characters.TwitterException
- when Twitter service or network is unavailableUser updateProfileBackgroundImage(File image, boolean tile) throws TwitterException
image
- Must be a valid GIF, JPG, or PNG image of less than 800 kilobytes in size. Images with width larger than 2048 pixels will be forceably scaled down.tile
- If set to true the background image will be displayed tiled. The image will not be tiled otherwise.TwitterException
- when Twitter service or network is unavailable,
or when the specified file is not found (FileNotFoundException will be nested),
or when the specified file object in not representing a file (IOException will be nested)User updateProfileBackgroundImage(InputStream image, boolean tile) throws TwitterException
image
- Must be a valid GIF, JPG, or PNG image of less than 800 kilobytes in size. Images with width larger than 2048 pixels will be forceably scaled down.tile
- If set to true the background image will be displayed tiled. The image will not be tiled otherwise.TwitterException
- when Twitter service or network is unavailable,
or when the specified file is not found (FileNotFoundException will be nested),
or when the specified file object in not representing a file (IOException will be nested)User updateProfileColors(String profileBackgroundColor, String profileTextColor, String profileLinkColor, String profileSidebarFillColor, String profileSidebarBorderColor) throws TwitterException
profileBackgroundColor
- optional, can be nullprofileTextColor
- optional, can be nullprofileLinkColor
- optional, can be nullprofileSidebarFillColor
- optional, can be nullprofileSidebarBorderColor
- optional, can be nullTwitterException
- when Twitter service or network is unavailableUser updateProfileImage(File image) throws TwitterException
image
- Must be a valid GIF, JPG, or PNG image of less than 700 kilobytes in size. Images with width larger than 500 pixels will be scaled down.TwitterException
- when Twitter service or network is unavailable,
or when the specified file is not found (FileNotFoundException will be nested),
or when the specified file object in not representing a file (IOException will be nested)User updateProfileImage(InputStream image) throws TwitterException
image
- Must be a valid GIF, JPG, or PNG image of less than 700 kilobytes in size. Images with width larger than 500 pixels will be scaled down.TwitterException
- when Twitter service or network is unavailable,
or when the specified file is not found (FileNotFoundException will be nested),
or when the specified file object in not representing a file (IOException will be nested)PagableResponseList<User> getBlocksList() throws TwitterException
TwitterException
- when Twitter service or network is unavailablePagableResponseList<User> getBlocksList(long cursor) throws TwitterException
cursor
- Causes the list of blocked users to be broken into pages of no more than 5000 IDs at a time. The number of IDs returned is not guaranteed to be 5000 as suspended users are filtered out after connections are queried. If no cursor is provided, a value of -1 will be assumed, which is the first "page."TwitterException
- when Twitter service or network is unavailableIDs getBlocksIDs() throws TwitterException
TwitterException
- when Twitter service or network is unavailableIDs getBlocksIDs(long cursor) throws TwitterException
cursor
- cursorTwitterException
- when Twitter service or network is unavailableUser createBlock(long userId) throws TwitterException
userId
- the ID of the user to blockTwitterException
- when Twitter service or network is unavailableUser createBlock(String screenName) throws TwitterException
screenName
- the screen_name of the user to blockTwitterException
- when Twitter service or network is unavailableUser destroyBlock(long userId) throws TwitterException
userId
- the ID of the user to blockTwitterException
- when Twitter service or network is unavailableUser destroyBlock(String screen_name) throws TwitterException
screen_name
- the screen_name of the user to blockTwitterException
- when Twitter service or network is unavailablePagableResponseList<User> getMutesList(long cursor) throws TwitterException
cursor
- Causes the list of muted users to be broken into pages of no more than 5000 IDs at a time. The number of IDs returned is not guaranteed to be 5000 as suspended users are filtered out after connections are queried. If no cursor is provided, a value of -1 will be assumed, which is the first "page."TwitterException
- when Twitter service or network is unavailableIDs getMutesIDs(long cursor) throws TwitterException
cursor
- Causes the list of muted users to be broken into pages of no more than 5000 IDs at a time. The number of IDs returned is not guaranteed to be 5000 as suspended users are filtered out after connections are queried. If no cursor is provided, a value of -1 will be assumed, which is the first "page."TwitterException
- when Twitter service or network is unavailableUser createMute(long userId) throws TwitterException
userId
- the user_id of the user to muteTwitterException
- when Twitter service or network is unavailableUser createMute(String screenName) throws TwitterException
screenName
- the screen_name of the user to muteTwitterException
- when Twitter service or network is unavailableUser destroyMute(long userId) throws TwitterException
userId
- the ID of the user to muteTwitterException
- when Twitter service or network is unavailableUser destroyMute(String screenName) throws TwitterException
screenName
- the screen_name of the user to muteTwitterException
- when Twitter service or network is unavailableResponseList<User> lookupUsers(long... ids) throws TwitterException
ids
- Specifies the IDs of the users to return.TwitterException
- when Twitter service or network is unavailableResponseList<User> lookupUsers(String... screenNames) throws TwitterException
screenNames
- Specifies the screen names of the users to return.TwitterException
- when Twitter service or network is unavailableUser showUser(long userId) throws TwitterException
userId
- the ID of the user for whom to request the detailTwitterException
- when Twitter service or network is unavailableUser showUser(String screenName) throws TwitterException
screenName
- the screen name of the user for whom to request the detailTwitterException
- when Twitter service or network is unavailableResponseList<User> searchUsers(String query, int page) throws TwitterException
query
- The query to run against people search.page
- Specifies the page of results to retrieve. Number of statuses per page is fixed to 20.TwitterException
- when Twitter service or network is unavailableResponseList<User> getContributees(long userId) throws TwitterException
userId
- The user id of the user for whom to return results forTwitterException
- when Twitter service or network is unavailableResponseList<User> getContributees(String screenName) throws TwitterException
screenName
- The screen name of the user for whom to return results forTwitterException
- when Twitter service or network is unavailableResponseList<User> getContributors(long userId) throws TwitterException
userId
- The user id of the user for whom to return results forTwitterException
- when Twitter service or network is unavailableResponseList<User> getContributors(String screenName) throws TwitterException
screenName
- The screen name of the user for whom to return results forTwitterException
- when Twitter service or network is unavailablevoid removeProfileBanner() throws TwitterException
TwitterException
- when Twitter service or network is unavailablevoid updateProfileBanner(File image) throws TwitterException
image
- For best results, upload an <5MB image that is exactly 1252px by 626px.TwitterException
- when Twitter service or network is unavailable,
or when the specified file is not found (FileNotFoundException will be nested),
or when the specified file object in not representing a file (IOException will be nested)void updateProfileBanner(InputStream image) throws TwitterException
image
- For best results, upload an <5MB image that is exactly 1252px by 626px.TwitterException
- when Twitter service or network is unavailable,
or when the specified file is not found (FileNotFoundException will be nested),
or when the specified file object in not representing a file (IOException will be nested)Copyright © 2018. All rights reserved.