# DeletionRequest.Builder

Artifact: [androidx.privacysandbox.ads:ads-adservices](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads) [View Source](https://cs.android.com/search?q=file:androidx/privacysandbox/ads/adservices/measurement/DeletionRequest.kt+class:androidx.privacysandbox.ads.adservices.measurement.DeletionRequest.Builder) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.0.0)

*** ** * ** ***


```
@RequiresApi(value = 26)
class DeletionRequest.Builder
```

<br />

*** ** * ** ***

Builder for {@link DeletionRequest} objects.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest.Builder#Builder(kotlin.Int,kotlin.Int)(deletionMode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, matchBehavior: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest` | `https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest.Builder#build()()` Builds a {@link DeletionRequest} instance. |
| `https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest.Builder` | `https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest.Builder#setDomainUris(kotlin.collections.List)(domainUris: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/android/net/Uri.html>)` Set the list of domain URI which will be used for matching. |
| `https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest.Builder` | `https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest.Builder#setEnd(java.time.Instant)(end: https://developer.android.com/reference/java/time/Instant.html)` Sets the end of the deletion range. |
| `https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest.Builder` | `https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest.Builder#setOriginUris(kotlin.collections.List)(originUris: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/android/net/Uri.html>)` Set the list of origin URI which will be used for matching. |
| `https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest.Builder` | `https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest.Builder#setStart(java.time.Instant)(start: https://developer.android.com/reference/java/time/Instant.html)` Sets the start of the deletion range. |

## Public constructors

### Builder

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.0.0)

```
Builder(deletionMode: Int, matchBehavior: Int)
```

| Parameters |
|---|---|
| `deletionMode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | {@link DeletionMode} Set the match behavior for the supplied params. {@link #DELETION_MODE_ALL}: All data associated with the selected records will be deleted. {@link #DELETION_MODE_EXCLUDE_INTERNAL_DATA}: All data except the internal system data (e.g. rate limits) associated with the selected records will be deleted. Value is one of the following: - `0` - `1` <br /> |
| `matchBehavior: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | {@link MatchBehavior} Set the match behavior for the supplied params. {@link #MATCH_BEHAVIOR_DELETE}: This option will use the supplied params (Origin URIs \& Domain URIs) for selecting records for deletion. {@link #MATCH_BEHAVIOR_PRESERVE}: This option will preserve the data associated with the supplied params (Origin URIs \& Domain URIs) and select remaining records for deletion. Value is one of the following: - `0` - `1` <br /> |

## Public functions

### build

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.0.0)

```
fun build(): DeletionRequest
```

Builds a {@link DeletionRequest} instance.

### setDomainUris

```
fun setDomainUris(domainUris: List<Uri>): DeletionRequest.Builder
```

Set the list of domain URI which will be used for matching. These will be matched with records using the same domain or any subdomains. E.g. If domainUri is {@code https://example.com}, then {@code https://a.example.com}, {@code https://example.com} and {@code https://b.example.com} will match; {@code https://abcexample.com} will NOT match. A null or empty list will match everything.

### setEnd

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.0.0)

```
fun setEnd(end: Instant): DeletionRequest.Builder
```

Sets the end of the deletion range. Not setting this or passing in {@link java.time.Instant#MAX} will cause everything from the specified start until the newest record to be deleted.

### setOriginUris

```
fun setOriginUris(originUris: List<Uri>): DeletionRequest.Builder
```

Set the list of origin URI which will be used for matching. These will be matched with records using the same origin only, i.e. subdomains won't match. E.g. If originUri is {@code https://a.example.com}, then {@code https://a.example.com} will match; {@code https://example.com}, {@code https://b.example.com} and {@code https://abcexample.com} will NOT match. A null or empty list will match everything.

### setStart

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.0.0)

```
fun setStart(start: Instant): DeletionRequest.Builder
```

Sets the start of the deletion range. Not setting this or passing in {@link java.time.Instant#MIN} will cause everything from the oldest record to the specified end be deleted.