SudoEmailClient

Interface encapsulating a library for interacting with the Sudo Platform Email service.

Samples

import android.content.Context
import com.sudoplatform.sudoemail.BaseTests
import com.sudoplatform.sudoemail.SudoEmailClient
import com.sudoplatform.sudoemail.SudoEmailNotifiableClient
import com.sudoplatform.sudoemail.SudoEmailNotificationHandler
import com.sudoplatform.sudoemail.types.EmailMessageReceivedNotification
import com.sudoplatform.sudonotification.SudoNotificationClient
import com.sudoplatform.sudouser.SudoUserClient
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.kotlin.mock
import org.robolectric.RobolectricTestRunner
fun main() { 
   //sampleStart 
   val emailClient = SudoEmailClient.builder()
    .setContext(context)
    .setSudoUserClient(sudoUserClient)
    .build() 
   //sampleEnd
}

Types

Link copied to clipboard
class Builder

Builder used to construct the SudoEmailClient.

Link copied to clipboard
object Companion
Link copied to clipboard

Defines the exceptions for the email address based methods.

Link copied to clipboard

Defines the exceptions for the email blocklist based methods.

Link copied to clipboard

Defines the exceptions for the email configuration based methods.

Link copied to clipboard

Defines the exceptions for the email cryptographic keys based methods.

Link copied to clipboard

Defines the exceptions for the email folder based methods.

Link copied to clipboard

Defines the exceptions for the email message based methods.

Functions

Link copied to clipboard
abstract suspend fun blockEmailAddresses(addresses: List<String>): BatchOperationResult<String, String>

Blocks the given email address(es) for the user identified

Link copied to clipboard

Check if an email address is available to be provisioned within a domain.

Link copied to clipboard
abstract fun close()
Link copied to clipboard

Creates a draft email message using RFC 6854 (supersedes RFC 822)(https://tools.ietf.org/html/rfc6854) data.

Link copied to clipboard

Delete multiple draft email messages with a list of identifiers.

Link copied to clipboard
abstract suspend fun deleteEmailMessage(id: String): String?

Delete a single EmailMessage using the id parameter.

Link copied to clipboard

Delete multiple EmailMessages using a list of identifiers.

Link copied to clipboard
abstract suspend fun deprovisionEmailAddress(id: String): EmailAddress

Deprovision an EmailAddress.

Link copied to clipboard
abstract suspend fun exportKeys(): ByteArray

Export the cryptographic keys to a key archive.

Link copied to clipboard
abstract suspend fun getConfigurationData(): ConfigurationData

Get the configuration data for the email service.

Link copied to clipboard

Retrieves a draft email message.

Link copied to clipboard
abstract suspend fun getEmailAddress(input: GetEmailAddressInput): EmailAddress?

Get an EmailAddress using its identifier.

Link copied to clipboard

Get email address blocklist for given owner.

Link copied to clipboard
abstract suspend fun getEmailMessage(input: GetEmailMessageInput): EmailMessage?

Get an EmailMessage using its identifier.

Link copied to clipboard

Get the RFC 6854 (supersedes RFC 822) data of an EmailMessage.

Link copied to clipboard

Get the body and attachment data of an EmailMessage.

Link copied to clipboard
abstract suspend fun getSupportedEmailDomains(cachePolicy: CachePolicy = CachePolicy.REMOTE_ONLY): List<String>

Get a list of the supported email domains.

Link copied to clipboard
abstract suspend fun importKeys(archiveData: ByteArray)

Import cryptographic keys from a key archive.

Link copied to clipboard

Lists the metadata of all draft messages for the user.

Lists the metadata of all draft messages for the specified email address identifier.

Link copied to clipboard

Lists the metadata and content of all draft messages for the user.

Link copied to clipboard

Lists the metadata and content of all draft messages for the specified email address identifier.

Link copied to clipboard
Link copied to clipboard

Get a list of EmailAddresses owned by the Sudo identified by sudoId.

Link copied to clipboard

Get a list of all EmailMessages for the user.

Link copied to clipboard

Get a list of EmailMessages for the specified email address identifier.

Link copied to clipboard

Get a list of EmailMessages for the specified email folder identifier.

Link copied to clipboard

Get a list of EmailAddressPublicInfo objects associated with the provided email addresses.

Link copied to clipboard
Link copied to clipboard
abstract fun reset()

Reset any internal state and cached content.

Link copied to clipboard

Send an email message using RFC 6854 (supersedes RFC 822)(https://tools.ietf.org/html/rfc6854) data.

Link copied to clipboard
abstract suspend fun subscribeToEmailMessages(id: String, subscriber: EmailMessageSubscriber)

Subscribes to be notified of new and deleted EmailMessages. Subscribing multiple times with the same subscriber id will cause the previous subscriber to be unsubscribed.

Link copied to clipboard
suspend fun SudoEmailClient.subscribeToEmailMessages(id: String, onConnectionChange: (status: Subscriber.ConnectionState) -> Unit = {}, onEmailMessageChanged: (emailMessage: EmailMessage) -> Unit)

Subscribes to be notified of new and deleted EmailMessages.

Link copied to clipboard
abstract suspend fun unblockEmailAddresses(addresses: List<String>): BatchOperationResult<String, String>

Unblocks the given email address(es) for the logged in user

Link copied to clipboard

Unblocks the email addresses associated with the hashed values passed in for the logged in user

Link copied to clipboard
abstract suspend fun unsubscribeAllFromEmailMessages()

Unsubscribe all subscribers from receiving notifications about modifications to EmailMessages.

Link copied to clipboard
abstract suspend fun unsubscribeFromEmailMessages(id: String)

Unsubscribe the specified subscriber so that it no longer receives notifications about new or deleted EmailMessages.

Link copied to clipboard

Updates a draft email message using RFC 6854 (supersedes RFC 822)(https://tools.ietf.org/html/rfc6854) data.

Link copied to clipboard

Update the metadata of an EmailAddress.