Skip to main content

Android Audience Service

Functions

syncSegmentDefinitions

suspend fun syncSegmentDefinitions(): Result<Unit>

Synchronizes segment definitions with the Orchestrator and updates local storage.

Parameters: None.

syncSegmentDefinitions

fun syncSegmentDefinitions(
onSuccess: () -> Unit,
onError: ((Throwable) -> Unit)?
): Unit

Synchronizes segment definitions with the Orchestrator and updates local storage.

Parameters:

  • onSuccess: () -> Unit — Called when synchronization completes successfully.
  • onError: ((Throwable) -> Unit)? — Called when an error occurs during synchronization.

getSegmentDefinitions

suspend fun getSegmentDefinitions(): Result<List<SegmentDefinition>>

Retrieves all available segment definitions from local storage.

Parameters: None.

getSegmentDefinitions

fun getSegmentDefinitions(
onSuccess: (List<SegmentDefinition>) -> Unit,
onError: ((Throwable) -> Unit)?
): Unit

Retrieves all available segment definitions from local storage.

Parameters:

  • onSuccess: (List<SegmentDefinition>) -> Unit — Called with the list of segment definitions.
  • onError: ((Throwable) -> Unit)? — Called when an error occurs while reading from local storage.

getSegmentDefinition

suspend fun getSegmentDefinition(name: String): Result<SegmentDefinition?>

Retrieves the Segment Definition having given programmatic name if there is any.

Parameters:

  • name: String — The unique programmatic name of the segment definition to retrieve.

getSegmentDefinition

fun getSegmentDefinition(
name: String,
onSuccess: (SegmentDefinition?) -> Unit,
onError: ((Throwable) -> Unit)?
): Unit

Retrieves the Segment Definition having given programmatic name if there is any.

Parameters:

  • name: String — The unique programmatic name of the segment definition to retrieve.
  • onSuccess: (SegmentDefinition?) -> Unit — Called with the matching segment definition, or null if not found.
  • onError: ((Throwable) -> Unit)? — Called when an error occurs while reading from local storage.

syncSegmentSubscriptions

suspend fun syncSegmentSubscriptions(): Result<Unit>

Synchronizes segment subscriptions.

Parameters: None.

syncSegmentSubscriptions

fun syncSegmentSubscriptions(
onSuccess: () -> Unit,
onError: ((Throwable) -> Unit)?
): Unit

Synchronizes segment subscriptions.

Parameters:

  • onSuccess: () -> Unit — Called when synchronization completes successfully.
  • onError: ((Throwable) -> Unit)? — Called when an error occurs during synchronization.

Classes

SegmentDefinition

data class SegmentDefinition(
val id: UUID,
val name: String,
val text: String,
val conditionJson: String,
val description: String? = null
)

SegmentSubscription

data class SegmentSubscription(
val segmentDefinitionId: UUID
)

Criteria

class Criteria(
val field: String,
val criteriaOperator: String,
val value: String
)

Filter

class Filter(
val type: String?,
val filters: List<Filter>?,
val filter: Filter?,
val criteria: Criteria?
)