Accept Agreements

Accept all terms of service agreements.

Android

/**
  * @property agreements: Agreements to accept
  * @see Agreement.NeededResponse
  *
  * @return VsLiveData<AgreementNeededDetails> object.  Retain this object and use it to interact with the sdk.
  */
fun acceptAgreements(agreements: AgreementNeededDetails): VsLiveData<Session>
// This object can be obtained from getAgreements or getRequiredAgreements.
val requiredAgreements: AgreementNeededDetails

SDK.Agreements.acceptAgreements(requiredAgreements)
  .observe(object : VsObserver<Session>() {
    override fun onError(error: Throwable) {}

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

iOS

/// - Parameters:
///   - agreementIDs: An array of agreement ids that needs to be accepted.
///   - completionHandler: Will be called after user's response is sent to the server.
///     Provides a Bool representing successful receipt by the server, and/or an error describing what went wrong.
acceptAgreements(requiredAgreements: RequiredAgreements, completionHandler: @escaping AgreementService.RequiredAgreementsHandler)
VersusSDK?.acceptAgreements(requiredAgreements: requiredAgreements, completionHandler: { (termsWereAccepted, error) in
    if let error = error {
        // error occurred
    } else if termsWereAccepted {
       // The user successfully accepted terms
    }
})