Get Agreements

Android

Get all agreements.

/**
* Retrieve all available terms agreements.
* This includes game/app specific agreements and Versus Agreements.
*
* @see Agreement.NeededResponse
*
* @return VsLiveData<AgreementNeededDetails> object.
*/
fun getAllAgreements(): VsLiveData<AgreementNeededDetails>
SDK.Agreements.getAllAgreements()
                .observe(object : VsObserver<Agreement.NeededResponse>() {
                    override fun onError(error: Throwable) {
                    }

                    override fun onChanged(t: Agreement.NeededResponse) {
                    }
                })

Determine Required App/Game/Versus Agreements for the authenticated user. Note: This includes game/app specific agreements and Versus Agreements.

/**
* @return VsLiveData<AgreementNeededDetails> object.  Retain this object and use it to interact with the sdk.
*/
fun determineRequiredAgreements(): VsLiveData<AgreementNeededDetails>
SDK.Agreements.getRequiredAgreements()
  .observe(object : VsObserver<Agreement.NeededResponse>() {
    override fun onError(error: Throwable) {
    }

    override fun onChanged(t: Agreement.NeededResponse) {
    }
  })

iOS

Determine Required App/Game/Versus Agreements for authenticated and unauthenticated users. This includes game/app specific agreements and Versus Agreements.

If a user is signed in, then only terms relevant to that user will be provided by this call. Otherwise, the server will provide all current terms.

/// - Parameters:
///     - completionHandler: Closure that returns the latest Agreements documents.
getNeededAgreements(_ completionHandler: @escaping VersusApiResponse<RequiredAgreements>)
VersusSDK?.getNeededAgreements({ (requiredAgreements, error) in
    if error != nil {
        // error occurred
    } else {
        // Successfully fetched agreements (contained within the RequiredAgreements response object)
    }
})