Package-level declarations

Types

Link copied to clipboard

Thrown when no valid access token is available for an A2A gRPC call.

Link copied to clipboard

Owns the gRPC channel to the A2A service and hands out stubs that already send the a2a-version header. Per-call auth metadata is added separately by A2aGrpcClient.

Link copied to clipboard
data class A2aConnectionConfig @JvmOverloads constructor(val host: String, val tenant: String, val port: Int = DEFAULT_PORT, val useTls: Boolean = true, val protocolVersion: String = DEFAULT_PROTOCOL_VERSION)

Connection settings for the A2A gRPC service.

Link copied to clipboard
sealed class A2aEvent

A typed piece of a server response. A response envelope can produce several events; they arrive in the order the server sent them. Every event carries the ids of its task and conversation (empty when the envelope had none).

Link copied to clipboard

Converts server stream envelopes into A2aEvents. Never throws: anything it cannot understand becomes A2aEvent.Unknown. Artifacts are routed by Artifact.metadata["action"]; an action name this SDK does not know is ignored.

Link copied to clipboard
class A2aGrpcClient @JvmOverloads constructor(tokenSource: AuthTokenSource, channelProvider: A2aChannelProvider? = null)

Thin auth layer for A2A gRPC calls. All token validity and refresh decisions are delegated to the AuthTokenSource; this class only attaches the bearer token and retries once on UNAUTHENTICATED.

Link copied to clipboard

One conversation with the A2A agent. A session spans many turns (one user message and the server's streamed reply each) that all share the same contextId.

Link copied to clipboard

Thrown from a turn flow when the turn cannot start or fails.

Link copied to clipboard
class A2aSessionManager(client: A2aGrpcClient, tenant: String)

Creates and tracks A2aSessions. Hold one per app (alongside the OtvSdkClient) so sessions outlive Activities. Sessions are in memory only and do not survive process death. Several sessions may be active at once; each has its own conversation context.

Link copied to clipboard

Lifecycle state of a server task.

Link copied to clipboard
data class ActionResult(val success: Boolean, val outcome: String, val message: String = "")

The client's report of a device action, sent with A2aSession.sendActionResult. It mirrors ActionResult in payloads.proto.

Link copied to clipboard

The action an artifact carries in Artifact.metadata["action"], as defined by ArtifactAction in payloads.proto. It tells the app which kind of event the artifact is.

Link copied to clipboard
interface AuthTokenSource

Supplies access tokens for authenticated A2A gRPC calls.

Link copied to clipboard

Joins A2aEvent.ChatText chunks into the full text per artifact.

Link copied to clipboard
data class ContentDetails(val contentId: String? = null, val type: String? = null, val title: String? = null, val description: String? = null, val year: Int? = null, val contentType: String? = null, val durationSeconds: Int? = null, val imageUrl: String? = null, val actors: List<String> = emptyList(), val categories: List<String> = emptyList(), val ratings: List<ContentRating> = emptyList(), val provider: String? = null, val epg: EpgInfo? = null, val seasonNumber: String? = null, val episodeNumber: Int? = null, val episodeTitle: String? = null, val seasons: List<SeasonInfo> = emptyList())

Display-ready details of one title (ContentDetails). Every field is optional: the server sends empty strings, zeros and empty lists for "not available", which are null or empty here. Show the text as plain text, never as HTML.

Link copied to clipboard
data class ContentItem(val contentId: String, val title: String? = null, val type: String? = null, val year: Int? = null, val synopsis: String? = null, val epg: EpgInfo? = null, val deeplink: DeepLink? = null)

A piece of content in a rail.

Link copied to clipboard
data class ContentRail(val heading: String?, val source: RailSource, val items: List<ContentItem>)

One row of content with its heading and the tool that produced it.

Link copied to clipboard
data class ContentRating(val body: String?, val code: String?, val label: String?, val countryCode: String?)

A rating of a title; an empty field is null.

Link copied to clipboard
data class DeepLink(val screen: String?, val deeplink: String?)

Where a content item leads in the app.

Link copied to clipboard
class DeviceCapabilities(voiceProbe: VoiceRecognizerProbe, translationAvailability: TranslationAvailability = TranslationAvailability.UNAVAILABLE)

Reports which input features this device supports. No method throws; an unsupported or unexpected condition is reported as false.

Link copied to clipboard
data class EpgInfo(val channel: String?, val startTime: String?, val endTime: String?)

Electronic programme guide details of a broadcast item.

Link copied to clipboard
data class EpisodeInfo(val id: String?, val title: String?, val episodeNumber: Int?)

One episode of a SeasonInfo.

Link copied to clipboard
class MlKitTranslationEngine(requireWifi: Boolean = false) : TranslationEngine

ML Kit implementation of TranslationEngine. Models (about 30 MB per language) are downloaded on demand through Google Play services and kept on the device.

Link copied to clipboard
Link copied to clipboard

Adapts OtvSdkClient, the auth authority, to the AuthTokenSource contract.

Link copied to clipboard

Joins A2aEvent.RenderContent updates of one artifact into one rail. A server may stream a rail in pieces; items are matched by contentId and a later piece fills in or replaces fields.

Link copied to clipboard

The tool that produced a content rail.

Link copied to clipboard

Outcome of a personalised review lookup.

Link copied to clipboard
data class SeasonInfo(val id: String?, val title: String?, val seasonNumber: String?, val episodes: List<EpisodeInfo>)

One season of a series in ContentDetails.

Link copied to clipboard
data class SessionConfig @JvmOverloads constructor(val timeoutMs: Long? = null, val autoTranslate: Boolean = true, val translator: Translator = Translator.NONE)

Settings for one A2aSession.

Link copied to clipboard
data class SessionError(val code: SessionError.Code, val message: String, val cause: Throwable? = null)

A session-level error reported on A2aSession.errors or thrown as A2aSessionException. message is for developers; show your own text to the user. The original exception, when there is one, is in cause.

Link copied to clipboard

Lifecycle state of an A2aSession.

Link copied to clipboard
data class SpeechLanguage(val localeTag: String, val label: String)

A language the speech recognizer can be asked to recognize.

Link copied to clipboard
Link copied to clipboard

Tells whether text can be translated to English on this device.

Link copied to clipboard

The on-device language tools OnDeviceTranslator needs; ML Kit provides the real one.

Link copied to clipboard
data class TranslationResult(val text: String, val translated: Boolean, val detectedLanguage: String? = null)
Link copied to clipboard
interface Translator

Converts user text to English before it is sent. The backend is swappable.

Link copied to clipboard
object VoiceInput

Helpers for voice input. Android speech recognition runs in another app and returns through an Activity result, so the SDK does not record audio itself:

Link copied to clipboard
fun interface VoiceRecognizerProbe

Tells whether an app can handle ACTION_RECOGNIZE_SPEECH on this device.

Properties

Link copied to clipboard
const val ACTION_ID: String

The action id sent with every ActionResult.

Link copied to clipboard
const val DEVICE_TYPE: String

Value of the x-device-types header the A2A service requires on every call.