Profile operations
The Profile API provides comprehensive access to user profiles in the Fans United platform. It supports operations for retrieving, updating, and managing user profiles with different access levels.
Core Methods
Get Own Profile
suspend fun getOwn(): MutableProfile
Retrieves the authenticated user's profile with full read/write access. Returns a MutableProfile
that allows:
- Updating personal information (name, gender, country)
- Managing interests and follows
- Updating contact details (email, phone)
- Managing profile statistics and settings
Get Profile by ID
suspend fun getById(
userId: String,
disableCache: Boolean? = null
): ReadOnlyProfile?
Parameters:
userId
: Unique identifier of the userdisableCache
: Optional flag to bypass cache
Returns a ReadOnlyProfile
with read-only access to:
- Basic profile information
- Interest list
- Statistics
- Follow relationships
Get Multiple Profiles
suspend fun getByIds(
ids: List<String>? = null,
search: String? = null,
disableCache: Boolean? = null
): PagedResponse<List<ProfileModel?>>
Retrieves multiple profiles either by IDs or search term:
ids
: List of profile IDs to retrievesearch
: Optional search term to find profilesdisableCache
: Optional flag to bypass cache
Check Follow Status
suspend fun checkFollowStatus(
profileIds: List<String>
): PagedResponse<FollowStatus>?
Checks follow relationships between the current user and specified profiles:
- Returns lists of profiles that:
- Follow the current user
- Are followed by the current user
- Have mutual follow relationships
Get Countries
suspend fun getCountries(): PagedResponse<List<ProfileCountry>>?
Retrieves available countries for profile settings.
Collect Lead
suspend fun collectLead(
requestBody: LeadRequestBody
): SimpleResponse<LeadModel>
Collects and stores lead information:
- Requires
LeadRequestBody
with contact and campaign details - Returns created
LeadModel
Profile Operations Examples
Update Profile Information
val profile = sdk.profile().getOwn()
.setName("John Doe")
.setGender(Gender.MALE)
.setCountry("profile:cnt:71")
.setEmail("[email protected]")
.update()
Manage Interests
val profile = sdk.profile().getOwn()
.addInterest(Interest(
id = "fb:t:123",
source = InterestSource.FOOTBALL,
favourite = true,
type = Type.TEAM
))
.update()
Follow Operations
// Follow users
sdk.profile().getOwn().follow(listOf("userId1", "userId2"))
// Check follow status
val status = sdk.profile().checkFollowStatus(listOf("userId1", "userId2"))
Error Handling
try {
sdk.profile().getById("invalidId")
} catch (e: FansUnitedException) {
println("Error: ${e.message}")
println("Code: ${e.code}")
}
Note: All profile operations are suspending functions and should be called from a coroutine scope.
Updated 3 days ago