ContentCardUIProvider

Messaging extension implementation of AepUIContentProvider. ContentCardUIProvider fetches and manages content for a given surface and exposes card lists through getContentCardUIFlow. When you render cards with ContentCardEventObserver and pass this provider as the optional second argument, the same flow can emit updated lists after interactions (for example dismiss) without calling refreshContent.

Methods

getContentCardUIFlow

Retrieves a Flow of Result containing AepUI instances for the given surface, which only emits values when there is an active collector. Content is fetched lazily when the flow is collected. The flow continues to emit updates when refreshContent is called or when card UI events are processed via ContentCardEventObserver.

Returns

A Flow that emits a Result containing a list of AepUI instances.

Syntax

data-slots=heading, code
data-repeat=1
data-languages=Kotlin

Kotlin

fun getContentCardUIFlow(): Flow<Result<List<AepUI<*, *>>>>

getContentCardUI (Deprecated)

data-variant=warning
data-slots=text
Deprecated — use getContentCardUIFlow instead. This suspend overload eagerly fetches content before returning the flow and requires a coroutine call site to obtain the flow reference.

Syntax

data-slots=heading, code
data-repeat=1
data-languages=Kotlin

Kotlin

@Deprecated("Use getContentCardUIFlow() instead.")
suspend fun getContentCardUI(): Flow<Result<List<AepUI<*, *>>>>

refreshContent

Fetches the latest content cards for the given surface and pushes the update to all active collectors of getContentCardUIFlow.

Syntax

data-slots=heading, code
data-repeat=1
data-languages=Kotlin

Kotlin

override suspend fun refreshContent()

getUIContent

Retrieves a Flow of Result containing AepUITemplate instances for the given surface, which only emit values when there is an active collector.. Content is fetched lazily when the flow is collected. The flow continues to emit updates when refreshContent is called.

Prefer getContentCardUIFlow when rendering with Compose UI components, as it emits AepUI instances ready for use with card composables.

Returns

A Flow that emits a Result containing a list of AepUITemplate instances.

Syntax

data-slots=heading, code
data-repeat=1
data-languages=Kotlin

Kotlin

override fun getUIContent(): Flow<Result<List<AepUITemplate>>>

getContent (Deprecated)

data-variant=warning
data-slots=text
Deprecated — use getUIContent instead. This suspend overload eagerly fetches content before returning the flow and requires a coroutine call site to obtain the flow reference.

Syntax

data-slots=heading, code
data-repeat=1
data-languages=Kotlin

Kotlin

@Deprecated("Use getUIContent instead", ReplaceWith("getUIContent"))
override suspend fun getContent(): Flow<Result<List<AepUITemplate>>>