twitter4j.api
Interface FriendshipMethods

All Known Subinterfaces:
Twitter
All Known Implementing Classes:
TwitterImpl

public interface FriendshipMethods

Author:
Joern Huxhorn - jhuxhorn at googlemail.com

Method Summary
 User createFriendship(long userId)
          Allows the authenticating users to follow the user specified in the ID parameter.
Returns the befriended user in the requested format when successful.
 User createFriendship(long userId, boolean follow)
          Allows the authenticating users to follow the user specified in the ID parameter.
Returns the befriended user in the requested format when successful.
 User createFriendship(java.lang.String screenName)
          Allows the authenticating users to follow the user specified in the ID parameter.
Returns the befriended user in the requested format when successful.
 User createFriendship(java.lang.String screenName, boolean follow)
          Allows the authenticating users to follow the user specified in the ID parameter.
Returns the befriended user in the requested format when successful.
 User destroyFriendship(long userId)
          Allows the authenticating users to unfollow the user specified in the ID parameter.
Returns the unfollowed user in the requested format when successful.
 User destroyFriendship(java.lang.String screenName)
          Allows the authenticating users to unfollow the user specified in the ID parameter.
Returns the unfollowed user in the requested format when successful.
 boolean existsFriendship(java.lang.String userA, java.lang.String userB)
          Tests for the existence of friendship between two users.
 IDs getIncomingFriendships(long cursor)
          Returns an array of numeric IDs for every user who has a pending request to follow the authenticating user.
 IDs getOutgoingFriendships(long cursor)
          Returns an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request.
 ResponseList<Friendship> lookupFriendships(long[] ids)
          Returns the relationship of the authenticating user to the specified users.
 ResponseList<Friendship> lookupFriendships(java.lang.String[] screenNames)
          Returns the relationship of the authenticating user to the specified users.
 Relationship showFriendship(long sourceId, long targetId)
          Returns detailed information about the relationship between two users.
 Relationship showFriendship(java.lang.String sourceScreenName, java.lang.String targetScreenName)
          Returns detailed information about the relationship between two users.
 Relationship updateFriendship(long userId, boolean enableDeviceNotification, boolean retweets)
          Allows you to enable or disable retweets and device notifications from the specified user.
 Relationship updateFriendship(java.lang.String screenName, boolean enableDeviceNotification, boolean retweets)
          Allows you to enable or disable retweets and device notifications from the specified user.
 

Method Detail

createFriendship

User createFriendship(java.lang.String screenName)
                      throws TwitterException
Allows the authenticating users to follow the user specified in the ID parameter.
Returns the befriended user in the requested format when successful. Returns a string describing the failure condition when unsuccessful. If you are already friends with the user an HTTP 403 will be returned.
This method calls http://api.twitter.com/1/friendships/create/[id].json

Parameters:
screenName - the screen name of the user to be befriended
Returns:
the befriended user
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
Twitter4J 2.0.1
See Also:
POST friendships/create | dev.twitter.com

createFriendship

User createFriendship(long userId)
                      throws TwitterException
Allows the authenticating users to follow the user specified in the ID parameter.
Returns the befriended user in the requested format when successful. Returns a string describing the failure condition when unsuccessful. If you are already friends with the user an HTTP 403 will be returned.
This method calls http://api.twitter.com/1/friendships/create/[id].json

Parameters:
userId - the ID of the user to be befriended
Returns:
the befriended user
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
Twitter4J 2.1.0
See Also:
POST friendships/create | dev.twitter.com

createFriendship

User createFriendship(java.lang.String screenName,
                      boolean follow)
                      throws TwitterException
Allows the authenticating users to follow the user specified in the ID parameter.
Returns the befriended user in the requested format when successful. Returns a string describing the failure condition when unsuccessful. If you are already friends with the user an HTTP 403 will be returned.
This method calls http://api.twitter.com/1/friendships/create/[id].json

Parameters:
screenName - the screen name of the user to be befriended
follow - Enable notifications for the target user in addition to becoming friends.
Returns:
the befriended user
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
Twitter4J 2.0.2
See Also:
POST friendships/create | dev.twitter.com

createFriendship

User createFriendship(long userId,
                      boolean follow)
                      throws TwitterException
Allows the authenticating users to follow the user specified in the ID parameter.
Returns the befriended user in the requested format when successful. Returns a string describing the failure condition when unsuccessful. If you are already friends with the user an HTTP 403 will be returned.
This method calls http://api.twitter.com/1/friendships/create/[id].json

Parameters:
userId - the ID of the user to be befriended
follow - Enable notifications for the target user in addition to becoming friends.
Returns:
the befriended user
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
Twitter4J 2.1.0
See Also:
POST friendships/create | dev.twitter.com

destroyFriendship

User destroyFriendship(java.lang.String screenName)
                       throws TwitterException
Allows the authenticating users to unfollow the user specified in the ID parameter.
Returns the unfollowed user in the requested format when successful. Returns a string describing the failure condition when unsuccessful.
This method calls http://api.twitter.com/1/friendships/destroy/[id].json

Parameters:
screenName - the screen name of the user for whom to request a list of friends
Returns:
User
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
Twitter4J 2.0.1
See Also:
POST friendships/destroy | dev.twitter.com

destroyFriendship

User destroyFriendship(long userId)
                       throws TwitterException
Allows the authenticating users to unfollow the user specified in the ID parameter.
Returns the unfollowed user in the requested format when successful. Returns a string describing the failure condition when unsuccessful.
This method calls http://api.twitter.com/1/friendships/destroy/[id].json

Parameters:
userId - the ID of the user for whom to request a list of friends
Returns:
User
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
Twitter4J 2.1.0
See Also:
POST friendships/destroy | dev.twitter.com

existsFriendship

boolean existsFriendship(java.lang.String userA,
                         java.lang.String userB)
                         throws TwitterException
Tests for the existence of friendship between two users. Will return true if user_a follows user_b, otherwise will return false.
This method calls http://api.twitter.com/1/friendships/exists.json

Parameters:
userA - The ID or screen_name of the first user to test friendship for.
userB - The ID or screen_name of the second user to test friendship for.
Returns:
if a friendship exists between two users.
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
Twitter4J 2.0.1
See Also:
GET friendships/exists | dev.twitter.com

showFriendship

Relationship showFriendship(java.lang.String sourceScreenName,
                            java.lang.String targetScreenName)
                            throws TwitterException
Returns detailed information about the relationship between two users.
This method calls http://api.twitter.com/1/friendships/show.json

Parameters:
sourceScreenName - the screen name of the source user
targetScreenName - the screen name of the target user
Returns:
Relationship
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
Twitter4J 2.1.0
See Also:
GET friendships/show | dev.twitter.com

showFriendship

Relationship showFriendship(long sourceId,
                            long targetId)
                            throws TwitterException
Returns detailed information about the relationship between two users.
This method calls http://api.twitter.com/1/friendships/show.json

Parameters:
sourceId - the ID of the source user
targetId - the ID of the target user
Returns:
Relationship
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
Twitter4J 2.1.0
See Also:
GET friendships/show | dev.twitter.com

getIncomingFriendships

IDs getIncomingFriendships(long cursor)
                           throws TwitterException
Returns an array of numeric IDs for every user who has a pending request to follow the authenticating user.
This method calls http://api.twitter.com/1/friendships/incoming.json

Parameters:
cursor - Breaks the results into pages. A single page contains 5000 identifiers. Provide a value of -1 to begin paging.
Returns:
an array of numeric IDs for every user who has a pending request to follow the authenticating user.
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
Twitter4J 2.1.2
See Also:
GET friendships/incoming | dev.twitter.com

getOutgoingFriendships

IDs getOutgoingFriendships(long cursor)
                           throws TwitterException
Returns an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request.
This method calls http://api.twitter.com/1/friendships/outgoing.json

Parameters:
cursor - Breaks the results into pages. A single page contains 5000 identifiers. Provide a value of -1 to begin paging.
Returns:
an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request.
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
Twitter4J 2.1.2
See Also:
GET friendships/outgoing | dev.twitter.com

lookupFriendships

ResponseList<Friendship> lookupFriendships(java.lang.String[] screenNames)
                                           throws TwitterException
Returns the relationship of the authenticating user to the specified users.
This method has not been finalized and the interface is subject to change in incompatible ways.
This method calls http://api.twitter.com/1/friendships/lookup.json

Parameters:
screenNames - array of the screen names to lookup
Returns:
list of Relationships
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
Twitter4J 2.1.9
See Also:
#newtwitter and the API - Twitter API Announcements | Google Group

lookupFriendships

ResponseList<Friendship> lookupFriendships(long[] ids)
                                           throws TwitterException
Returns the relationship of the authenticating user to the specified users.
This method has not been finalized and the interface is subject to change in incompatible ways.
This method calls http://api.twitter.com/1/friendships/lookup.json

Parameters:
ids - array of the ids to lookup
Returns:
list of Relationships
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
Twitter4J 2.1.9
See Also:
#newtwitter and the API - Twitter API Announcements | Google Group

updateFriendship

Relationship updateFriendship(java.lang.String screenName,
                              boolean enableDeviceNotification,
                              boolean retweets)
                              throws TwitterException
Allows you to enable or disable retweets and device notifications from the specified user.
This method has not been finalized and the interface is subject to change in incompatible ways.
This method calls http://api.twitter.com/1/friendships/update.json

Parameters:
screenName - screen name to update
enableDeviceNotification - set true to enable device notification
retweets - set true to enable retweets
Returns:
Relationship
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
Twitter4J 2.1.9
See Also:
#newtwitter and the API - Twitter API Announcements | Google Group

updateFriendship

Relationship updateFriendship(long userId,
                              boolean enableDeviceNotification,
                              boolean retweets)
                              throws TwitterException
Allows you to enable or disable retweets and device notifications from the specified user.
This method has not been finalized and the interface is subject to change in incompatible ways.
This method calls http://api.twitter.com/1/friendships/update.json

Parameters:
userId - user id to update
enableDeviceNotification - set true to enable device notification
retweets - set true to enable retweets
Returns:
Relationship
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
Twitter4J 2.1.9
See Also:
#newtwitter and the API - Twitter API Announcements | Google Group