Skip to main content
Logo
Explore APIsContact Us
  • Home
  1. Resources
  2. Virtual Stadium
  3. Profile Provider

Profile Provider

The ProfileProvider is a service component responsible for managing and providing user profile-related data within the Virtual Stadium Data SDK.


#Overview

The ProfileProvider handles all user profile operations and exposes profile data through observable state flows.

#Primary Functions

Fetching User Data

Retrieves detailed information about a user, such as their profile details, based on a user ID.

Providing User Avatar URL

Supplies the URL of the user's avatar image for display purposes.

Fetching Shared Bets

Retrieves the bets shared by a specific user with pagination support.


#Profile Implementation

Access profile data through the ProfileProvider by injecting it via dependency injection.

The profileState flow exposes current profile data and updates automatically.

#Available Methods

  • getUserAvatarUrl() - Get avatar URL for a user
  • getUserData() - Fetch detailed user profile
  • getUsersSharedBets() - Get user's shared bets (first page)
  • getPreviousUsersSharedBets() - Load additional shared bets (pagination)
kotlin
import ag.sportradar.virtualstadium.datasdk.services.ProfileProvider
import androidx.lifecycle.ViewModel
import org.koin.core.component.KoinComponent
import org.koin.core.component.get

class ProfileViewModel :
    ViewModel(),
    KoinComponent {

    private val profileProvider: ProfileProvider
        get() = get()

    val profileState = profileProvider.profileState

    fun getUserAvatar(userId: String): String = 
        profileProvider.getUserAvatarUrl(userId)

    fun getUserData(userId: String) {
        profileProvider.getUserData(userId)
    }

    fun getSharedBets(userId: String) {
        profileProvider.getUsersSharedBets(userId)
    }

    fun getPreviousSharedBets(userId: String) {
        profileProvider.getPreviousUsersSharedBets(userId)
    }
}
Last updated about 1 month ago
Is this site helpful?
Virtual Stadium, Moderation, Engagement Tools
Chat SettingsCentral Hub
On this page
  • Overview
  • Primary Functions
  • Profile Implementation
  • Available Methods