Package de.jcm.discordgamesdk
Class RelationshipManager
java.lang.Object
de.jcm.discordgamesdk.RelationshipManager
Manager to fetch information about the current user's relationships with other users.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Predicate<Relationship> Matches friends (RelationshipType.FRIEND):static final Predicate<Relationship> Matches any relationship.static final Predicate<Relationship> Matches offline (not idle or DND) users (OnlineStatus.OFFLINE).static final Predicate<Relationship> Matches online (not idle or DND) users (OnlineStatus.ONLINE).static final Predicate<Relationship> Matches users that are doing something special (playing, watching, listening, having a custom status, etc.). -
Method Summary
Modifier and TypeMethodDescriptionasList()Fetches a filtered list of relationships.intcount()Fetches the count of relationships that match your filter.voidfilter(Predicate<Relationship> filter) Filters the user's relationship by a certainPredicate.getAt(int index) Fetches a relationships at a certain position in the filtered list.getWith(long userId) Fetches the relationship with another user.
-
Field Details
-
NO_FILTER
Matches any relationship. -
FRIEND_FILTER
Matches friends (RelationshipType.FRIEND): -
ONLINE_FILTER
Matches online (not idle or DND) users (OnlineStatus.ONLINE). -
OFFLINE_FILTER
Matches offline (not idle or DND) users (OnlineStatus.OFFLINE). -
SPECIAL_FILTER
Matches users that are doing something special (playing, watching, listening, having a custom status, etc.).
-
-
Method Details
-
getWith
Fetches the relationship with another user.- Parameters:
userId- ID to identifier the other user- Returns:
- The Relationship between the users
- Throws:
GameSDKException- if something went wrong fetching the relationship information- See Also:
-
filter
Filters the user's relationship by a certainPredicate.- Parameters:
filter-Predicateto filter the relationships with.- See Also:
-
count
public int count()Fetches the count of relationships that match your filter.
Only works if you called
filter(Predicate)first, returnsResult.NOT_FOUNDotherwise.- Returns:
- The count.
- Throws:
GameSDKException- if something went wrong fetching the relationship count- See Also:
-
getAt
Fetches a relationships at a certain position in the filtered list.
Only works if you called
filter(Predicate)first, returnsResult.NOT_FILTEREDotherwise.- Parameters:
index- The index of the relationships- Returns:
- The relationships
- Throws:
GameSDKException- if something went wrong fetching the relationship- See Also:
-
asList
Fetches a filtered list of relationships.Only works if you called
filter(Predicate)first, throws aGameSDKExceptionwithResult.NOT_FOUNDotherwise.- Returns:
- A list of relationships
- Throws:
GameSDKException- if something went wrong fetching the relationship list
-