Legal Documents

SDK introduces LegaDocuments service for fetching and submitting user consent.

getLegalDocuments

Fetches a collection of currently active legal documents.

Optional languageTag language tag (e.g., "en", "fr-CA"). If null or blank, the backend default localization is applied.

Concrete Example

let service = LegalDocumentsService()
service.getLegalDocuments(then: { result in
    switch result {
    case: .success(_)
        // successfully retrieved
    case: .failure(_)
        // failure error
    }
})

getLegalDocumentContent

Fetches the full content for a specific legal document.

Parameters:

  • documentId: The document ID that is available in the previous call. (when the list of documents is fetched)

To get the specific legal document, first host app needs to retrieve the documentId provided when the getLegalDocuments API call is made and need to provide the retrieved documentId as an argument to submitConsent API

Concrete Example

let service = LegalDocumentsService()
service.getLegalDocumentContent(documentId: String) { result in
    switch result {
    case: .success(_)
        // successfully updated
    case: .failure(_)
        // failure error
    }
}

submitConsent

Submits user consent for a specific legal document.

Parameters:

  • documentId: The document ID that is available in the previous call. (when the list of documents is fetched)

To submit the user consent, first host app needs to retrieve the documentId provided when the getLegalDocuments API call is made and need to provide the retrieved documentId as an argument to submitConsent API

Concrete Example

let service = LegalDocumentsService()
service.submitConsent(for documentId: String) { result in
    switch result {
    case: .success(_)
        // successfully updated
    case: .failure(_)
        // failure error
    }
})

Last updated