# 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
public class TakenAction.BuilderBase<T extends TakenAction.BuilderBase<T>>
```

<br />

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

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

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

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

*** ** * ** ***

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

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/appsearch/usagereporting/TakenAction.BuilderBase#BuilderBase(androidx.appsearch.usagereporting.TakenAction)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/appsearch/usagereporting/TakenAction takenAction)` Constructs `https://developer.android.com/reference/androidx/appsearch/usagereporting/TakenAction.BuilderBase` by copying existing values from the given `https://developer.android.com/reference/androidx/appsearch/usagereporting/TakenAction`. |
| `https://developer.android.com/reference/androidx/appsearch/usagereporting/TakenAction.BuilderBase#BuilderBase(java.lang.String,java.lang.String,long,int)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html namespace, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html id, long actionTimestampMillis, int actionType )` Constructs `https://developer.android.com/reference/androidx/appsearch/usagereporting/TakenAction.BuilderBase` with given `namespace`, `id`, `actionTimestampMillis` and `actionType`. |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/appsearch/usagereporting/TakenAction` | `https://developer.android.com/reference/androidx/appsearch/usagereporting/TakenAction.BuilderBase#build()()` For AppSearch annotation processor requirement only. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `https://developer.android.com/reference/androidx/appsearch/usagereporting/TakenAction.BuilderBase#setDocumentTtlMillis(long)(long documentTtlMillis)` Sets the time-to-live (TTL) of the `https://developer.android.com/reference/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)

```
public BuilderBase(@NonNull TakenAction takenAction)
```

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

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/appsearch/usagereporting/TakenAction takenAction` | an existing `https://developer.android.com/reference/androidx/appsearch/usagereporting/TakenAction` object. |

### BuilderBase

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

```
public BuilderBase(
    @NonNull String namespace,
    @NonNull String id,
    long actionTimestampMillis,
    int actionType
)
```

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

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html namespace` | The namespace of the `https://developer.android.com/reference/androidx/appsearch/usagereporting/TakenAction` document. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html id` | The id of the `https://developer.android.com/reference/androidx/appsearch/usagereporting/TakenAction` document. |
| `long actionTimestampMillis` | The timestamp when the user took the action, in milliseconds since Unix epoch. |
| `int actionType` | 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 methods

### build

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

```
public @NonNull TakenAction build()
```

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)

```
public @NonNull T setDocumentTtlMillis(long documentTtlMillis)
```

Sets the time-to-live (TTL) of the `https://developer.android.com/reference/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/androidx/appsearch/usagereporting/TakenAction#getActionTimestampMillis()`).

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

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