SudoDIRelayClient

Interface encapsulating a library for interacting with the Sudo Platform Decentralized Identity Relay service.

Samples

import android.content.Context
import com.sudoplatform.sudodirelay.BaseTests
import com.sudoplatform.sudodirelay.SudoDIRelayClient
import com.sudoplatform.sudodirelay.subscription.MessageSubscriber
import com.sudoplatform.sudodirelay.subscription.Subscriber
import com.sudoplatform.sudodirelay.types.Message
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.kotlin.mock
import org.robolectric.RobolectricTestRunner
fun main() { 
   //sampleStart 
   val relayClient = SudoDIRelayClient.builder()
    .setContext(context)
    .build() 
   //sampleEnd
}

Types

Link copied to clipboard
class Builder
Link copied to clipboard
object Companion
Link copied to clipboard

Defines the exceptions for the decentralized identity relay methods.

Functions

Link copied to clipboard
abstract suspend fun bulkDeleteMessage(messageIds: List<String>)

Request deletion of messages with IDs messageIds.

Link copied to clipboard
abstract suspend fun createPostbox(connectionId: String, ownershipProofToken: String, isEnabled: Boolean? = true): Postbox

Initializes a relay postbox with the given connectionId.

Link copied to clipboard
abstract suspend fun deleteMessage(messageId: String)

Request deletion of the message with ID of messageId.

Link copied to clipboard
abstract suspend fun deletePostbox(postboxId: String): String

Request deletion of the relay postbox with ID of postboxId.

Link copied to clipboard
abstract suspend fun listMessages(limit: Int? = null, nextToken: String? = null): ListOutput<Message>

Gets a list of at most limit Messages for the current user.

Link copied to clipboard
abstract suspend fun listPostboxes(limit: Int? = null, nextToken: String? = null): ListOutput<Postbox>

Gets a list of postboxes for the current user.

Link copied to clipboard
abstract suspend fun subscribeToRelayEvents(subscriberId: String, subscriber: MessageSubscriber)

Subscribes to notifications of incoming messages for the current user. Resubscribing with the same identifier will replace the existing subscription.

Link copied to clipboard
suspend fun SudoDIRelayClient.subscribeToRelayEvents(subscriberId: String, onConnectionChange: (status: Subscriber.ConnectionState) -> Unit = {}, messageCreated: (relayMessage: Message) -> Unit)

Subscribes to be notified of incoming messages.

Link copied to clipboard
abstract suspend fun unsubscribeAll()

Unsubscribe all subscribers from being notified about relay events.

Link copied to clipboard
abstract suspend fun unsubscribeToRelayEvents(subscriberId: String)

Unsubscribe from relay events with the subscription identifier subscriberId so that the subscriber is no longer notified about incoming messages.

Link copied to clipboard
abstract suspend fun updatePostbox(postboxId: String, isEnabled: Boolean? = null): Postbox

Request update of the relay postbox with ID of postboxId.