Get Currently Accepted Challenges

Get a list of Versus currently active challenges that a player has accepted in your game/app.

Android

/**
* @property page Page to request if there are multiple pages of challenges
* @property pageSize The maximum number of challenges that will come back per page.
* @return VsLiveData with an array of a players current Versus Challenges on success
 */
fun getPlayersCurrentChallenges(page: Int, pageSize: Int): VsLiveData<Array<Challenge>>
val page: Int = 1
val pageSize: Int = 10

SDK.Challenges.getPlayersCurrentChallenges(page, pageSize)
  .observe(object : VsObserver<Array<Challenge>>() {
    override fun onError(error: Throwable) {
    }

    override fun onChanged(t: Array<Challenge>) {
    }
})

iOS

/// - Parameters:
    ///   - pageNumber: Page of results to pull (defaults to 1)
    ///   - pageSize: Size of each pages results (defaults to 10)
    ///   - completionHandler: Closure which returns ChallengeResponse containing collection of Versus Challenges
getCurrentChallenges(pageNumber: Int, pageSize: Int, completionHandler: @escaping VersusApiResponse<ChallengeResponse>)
VersusSDK?.getCurrentChallenges(pageNumber: 1, pageSize: 10, completionHandler: { (challengeResponse, error) in
    if error != nil {
        // error occurred
    } else {
        // Successfully fetched current challenges (contained inside ChallengeResponse object)
    }
})