Get Challenge History

Get a list of previous 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 a list of completed Challenges
*/
fun getChallengeHistory(page: Int, pageSize: Int): VsLiveData<Array<Challenge>>
val page: Int = 1
val pageSize: Int = 10

SDK.Challenges.getChallengeHistory(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
getChallengeHistory(pageNumber: Int, pageSize: Int, completionHandler: @escaping VersusApiResponse<ChallengeResponse>)
VersusSDK?.getChallengeHistory(pageNumber: 1, pageSize: 10, completionHandler: { (challengeResponse, error) in
    if error != nil {
        // error occurred
    } else {
        // Successfully fetched challenges from challenge history (contained in ChallengeResponse object)
    }
})