Join Challenge

Join a Versus challenge.

Android

/**
* @property challenge: Versus challenge you'd like to start
* @property externalChallengeId: A game/app assigned id for tracking the challenge
* @property campaignId: Associated campaign id for a challenge
* @return VsLiveData with the affected Challenge
*/
fun start(challenge: Challenge, externalChallengeId: String, campaignId: String): VsLiveData<Challenge>
val challenge: Challenge

VersusDebugStateMachine.SDK.Challenges.start(
  challenge = challenge,
  externalChallengeId = "SomeOptionalChallengeId",
  campaignId = 1
)
.observe(object : VsObserver<Challenge>() {
    override fun onError(error: Throwable) {}

    override fun onChanged(t: Challenge) {}
})

iOS

/// - Parameters:
///     - challenge: Versus challenge you'd like to start
///     - externalChallengeId: A game assigned id for tracking the challenge
///     - campaignId: The id of the campaign for the prize the player is trying to acquire.
///     - completionHandler: Closure which returns a Versus Session (or Error)
startChallenge(_ challenge: Challenge, externalChallengeId: String, campaignId: String, completionHandler: @escaping VersusApiResponse<Challenge>) {
VersusSDK?.startChallenge(challenge, externalChallengeId: externalChallengeId, campaignId: prizeCampaignId, completionHandler: { (challenge, error) in
    if let error = error {
        // error occurred
    } else {
        // Successfully joined the returned `challenge`
    }
})