# DeletionRequest

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) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.0.0)

*** ** * ** ***


```
@RequiresApi(value = 26)
public final class DeletionRequest
```

<br />

*** ** * ** ***

Deletion Request.

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) public final class https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest.Builder` Builder for {@link DeletionRequest} objects. |

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest#DELETION_MODE_ALL() = 0` Deletion mode to delete all data associated with the selected records. |
| `static final int` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest#DELETION_MODE_EXCLUDE_INTERNAL_DATA() = 1` Deletion mode to delete all data except the internal data (e.g. rate limits) for the selected records. |
| `static final int` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest#MATCH_BEHAVIOR_DELETE() = 0` Match behavior option to delete the supplied params (Origin/Domains). |
| `static final int` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest#MATCH_BEHAVIOR_PRESERVE() = 1` Match behavior option to preserve the supplied params (Origin/Domains) and delete everything else. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest#DeletionRequest(kotlin.Int,kotlin.Int,java.time.Instant,java.time.Instant,kotlin.collections.List,kotlin.collections.List)( int deletionMode, int matchBehavior, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html start, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html end, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html> domainUris, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html> originUris )` |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final int` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest#getDeletionMode()()` Set the deletion mode for the supplied params. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html>` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest#getDomainUris()()` the list of domain URI which will be used for matching. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest#getEnd()()` `https://developer.android.com/reference/java/time/Instant.html` Set the end of the deletion range. |
| `final int` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest#getMatchBehavior()()` Set the match behavior for the supplied params. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html>` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest#getOriginUris()()` the list of origin URI which will be used for matching. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest#getStart()()` `https://developer.android.com/reference/java/time/Instant.html` Set the start of the deletion range. |
| `int` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest#hashCode()()` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest#toString()()` |

## Constants

### DELETION_MODE_ALL

```
public static final int DELETION_MODE_ALL = 0
```

Deletion mode to delete all data associated with the selected records.

### DELETION_MODE_EXCLUDE_INTERNAL_DATA

```
public static final int DELETION_MODE_EXCLUDE_INTERNAL_DATA = 1
```

Deletion mode to delete all data except the internal data (e.g. rate limits) for the selected records.

### MATCH_BEHAVIOR_DELETE

```
public static final int MATCH_BEHAVIOR_DELETE = 0
```

Match behavior option to delete the supplied params (Origin/Domains).

### MATCH_BEHAVIOR_PRESERVE

```
public static final int MATCH_BEHAVIOR_PRESERVE = 1
```

Match behavior option to preserve the supplied params (Origin/Domains) and delete everything else.

## Public constructors

### DeletionRequest

```
public DeletionRequest(
    int deletionMode,
    int matchBehavior,
    @NonNull Instant start,
    @NonNull Instant end,
    @NonNull List<@NonNull Uri> domainUris,
    @NonNull List<@NonNull Uri> originUris
)
```

| Parameters |
|---|---|
| `int deletionMode` | Set the deletion mode for the supplied params. `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest#DELETION_MODE_ALL()`: All data associated with the selected records will be deleted. `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest#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 /> |
| `int matchBehavior` | Set the match behavior for the supplied params. `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest#MATCH_BEHAVIOR_DELETE()`: This option will use the supplied params (Origin URIs \& Domain URIs) for selecting records for deletion. `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest#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 /> |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html start` | `https://developer.android.com/reference/java/time/Instant.html` Set the start of the deletion range. Not setting this or passing in java.time.Instant#MIN will cause everything from the oldest record to the specified end be deleted. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html end` | `https://developer.android.com/reference/java/time/Instant.html` Set the end of the deletion range. Not setting this or passing in java.time.Instant#MAX will cause everything from the specified start until the newest record to be deleted. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html> domainUris` | 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. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html> originUris` | 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. |

## Public methods

### equals

```
public boolean equals(Object other)
```

### getDeletionMode

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

```
public final int getDeletionMode()
```

Set the deletion mode for the supplied params. `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest#DELETION_MODE_ALL()`: All data associated with the selected records will be deleted. `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest#DELETION_MODE_EXCLUDE_INTERNAL_DATA()`: All data except the internal system data (e.g. rate limits) associated with the selected records will be deleted.

### getDomainUris

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

```
public final @NonNull List<@NonNull Uri> getDomainUris()
```

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.

### getEnd

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

```
public final @NonNull Instant getEnd()
```

`https://developer.android.com/reference/java/time/Instant.html` Set the end of the deletion range. Not setting this or passing in java.time.Instant#MAX will cause everything from the specified start until the newest record to be deleted.

### getMatchBehavior

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

```
public final int getMatchBehavior()
```

Set the match behavior for the supplied params. `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest#MATCH_BEHAVIOR_DELETE()`: This option will use the supplied params (Origin URIs \& Domain URIs) for selecting records for deletion. `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest#MATCH_BEHAVIOR_PRESERVE()`: This option will preserve the data associated with the supplied params (Origin URIs \& Domain URIs) and select remaining records for deletion.

### getOriginUris

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

```
public final @NonNull List<@NonNull Uri> getOriginUris()
```

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.

### getStart

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

```
public final @NonNull Instant getStart()
```

`https://developer.android.com/reference/java/time/Instant.html` Set the start of the deletion range. Not setting this or passing in java.time.Instant#MIN will cause everything from the oldest record to the specified end be deleted.

### hashCode

```
public int hashCode()
```

### toString

```
public @NonNull String toString()
```