# TakenAction.BuilderBase

Artifact: [androidx.appsearch:appsearch](https://developer.android.com/jetpack/androidx/releases/appsearch) [View Source](https://cs.android.com/search?q=file:androidx/appsearch/usagereporting/TakenAction.java+class:androidx.appsearch.usagereporting.TakenAction.BuilderBase) Added in [1.2.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appsearch#1.2.0-alpha02)

*** ** * ** ***


```
@ExperimentalAppSearchApi
class TakenAction.BuilderBase<T : TakenAction.BuilderBase<T!>?>
```

<br />

Known direct subclasses [ClickAction.BuilderBase](https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/ClickAction.BuilderBase), [DismissAction.BuilderBase](https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/DismissAction.BuilderBase), [ImpressionAction.BuilderBase](https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/ImpressionAction.BuilderBase), [SearchAction.BuilderBase](https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction.BuilderBase)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/ClickAction.BuilderBase` | Builder for `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/ClickAction`. |
| `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/DismissAction.BuilderBase` | Builder for `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/DismissAction`. |
| `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/ImpressionAction.BuilderBase` | Builder for `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/ImpressionAction`. |
| `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction.BuilderBase` | Builder for `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction`. |

Known indirect subclasses [ClickAction.Builder](https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/ClickAction.Builder), [DismissAction.Builder](https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/DismissAction.Builder), [ImpressionAction.Builder](https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/ImpressionAction.Builder), [SearchAction.Builder](https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction.Builder)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/ClickAction.Builder` | Builder for `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/ClickAction`. |
| `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/DismissAction.Builder` | Builder for `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/DismissAction`. |
| `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/ImpressionAction.Builder` | Builder for `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/ImpressionAction`. |
| `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction.Builder` | Builder for `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction`. |

*** ** * ** ***

Builder for `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction.BuilderBase#BuilderBase(androidx.appsearch.usagereporting.TakenAction)(takenAction: https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction)` Constructs `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction.BuilderBase` by copying existing values from the given `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction`. |
| `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction.BuilderBase#BuilderBase(java.lang.String,java.lang.String,long,int)( namespace: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, actionTimestampMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, actionType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Constructs `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction.BuilderBase` with given `namespace`, `id`, `actionTimestampMillis` and `actionType`. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction` | `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction.BuilderBase#build()()` For AppSearch annotation processor requirement only. |
| `T` | `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction.BuilderBase#setDocumentTtlMillis(long)(documentTtlMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Sets the time-to-live (TTL) of the `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction` document as a duration in milliseconds. |

## Public constructors

### BuilderBase

Added in [1.2.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appsearch#1.2.0-alpha02)

```
BuilderBase(takenAction: TakenAction)
```

Constructs `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction.BuilderBase` by copying existing values from the given `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction`.

| Parameters |
|---|---|
| `takenAction: https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction` | an existing `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction` object. |

### BuilderBase

Added in [1.2.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appsearch#1.2.0-alpha02)

```
BuilderBase(
    namespace: String,
    id: String,
    actionTimestampMillis: Long,
    actionType: Int
)
```

Constructs `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction.BuilderBase` with given `namespace`, `id`, `actionTimestampMillis` and `actionType`.

| Parameters |
|---|---|
| `namespace: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The namespace of the `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction` document. |
| `id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The id of the `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction` document. |
| `actionTimestampMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The timestamp when the user took the action, in milliseconds since Unix epoch. |
| `actionType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The action type enum of the Document. Value is one of the following: - `ActionConstants.ACTION_TYPE_UNKNOWN` - `ActionConstants.ACTION_TYPE_SEARCH` - `ActionConstants.ACTION_TYPE_CLICK` - `ActionConstants.ACTION_TYPE_IMPRESSION` - `ActionConstants.ACTION_TYPE_DISMISS` <br /> |

## Public functions

### build

Added in [1.2.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appsearch#1.2.0-alpha02)

```
fun build(): TakenAction
```

For AppSearch annotation processor requirement only. The client should never call it since it is impossible to instantiate an abstract class.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` |   |

### setDocumentTtlMillis

Added in [1.2.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appsearch#1.2.0-alpha02)

```
fun setDocumentTtlMillis(documentTtlMillis: Long): T
```

Sets the time-to-live (TTL) of the `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction` document as a duration in milliseconds.

The document will be automatically deleted when the TTL expires (since `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction#getActionTimestampMillis()`).

The default TTL for `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction` document is 60 days.

See `https://developer.android.com/reference/kotlin/androidx/appsearch/annotation/Document.TtlMillis` for more information on TTL.