Class RelationshipRepository
- java.lang.Object
-
- edu.cnm.deepdive.tunefull.service.RelationshipRepository
-
public class RelationshipRepository extends Object
TheRelationshipRepository
provides methods that talk to theTunefullWebService
to receive and save data from and to the server.
-
-
Constructor Summary
Constructors Constructor Description RelationshipRepository(Context context)
The constructor gets instances of the singletonsTunefullWebService
andGoogleSignInService
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Single<List<Relationship>>
getFollowing()
Returns the current user's following relationships.Single<List<Relationship>>
getFriendships()
Returns the current user's friendships.Single<List<Relationship>>
getPendingRelationships()
Returns the current user's pending (i.e.Single<Relationship>
saveRelationship(Relationship relationship)
Saves a relationship between two users.Single<Relationship>
updateRelationship(Relationship relationship, boolean friendAccepted)
Updates a selected relationship.
-
-
-
Constructor Detail
-
RelationshipRepository
public RelationshipRepository(Context context)
The constructor gets instances of the singletonsTunefullWebService
andGoogleSignInService
.- Parameters:
context
- The current context.
-
-
Method Detail
-
saveRelationship
public Single<Relationship> saveRelationship(Relationship relationship)
Saves a relationship between two users.- Parameters:
relationship
- The relationship to be saved.- Returns:
- A
Single
of the saved relationship.
-
getFriendships
public Single<List<Relationship>> getFriendships()
Returns the current user's friendships.- Returns:
- A
Single
of the current user's friendships.
-
getFollowing
public Single<List<Relationship>> getFollowing()
Returns the current user's following relationships.- Returns:
- A
Single
of the current user's following relationships.
-
getPendingRelationships
public Single<List<Relationship>> getPendingRelationships()
Returns the current user's pending (i.e. unaccepted) relationships.- Returns:
- A
Single
of the current user's profile.
-
updateRelationship
public Single<Relationship> updateRelationship(Relationship relationship, boolean friendAccepted)
Updates a selected relationship.- Parameters:
relationship
- The relationship to be updated.friendAccepted
- Whether the friend request has been accepted or not.- Returns:
- A
Single
of the updated relationship.
-
-