# ConsentResource

Canonical page: https://docs.ovok.com/java-sdk/reference/consent-resource

```java
public final class ConsentResource
```

Reads and records the signed-in user's consents and requests consent signatures. Get it from [`Ovok.consent()`](/java-sdk/reference/ovok#consent).

## Methods [#methods]

### legal [#legal]

```java
public ConsentResource.LegalConsentResource legal()
```

Returns the legal (terms and conditions) consent routes.

**Returns:** the legal consent resource

### medical [#medical]

```java
public ConsentResource.MedicalConsentResource medical()
```

Returns the medical-notifications consent routes.

**Returns:** the medical consent resource

### requestSignature [#requestsignature]

```java
public JsonNode requestSignature(String consentId) throws IOException, InterruptedException
```

Requests a signature for a consent (`POST /consent/signature/{consentId}`).

**Parameters:**

- `consentId`: the `Consent` id

**Returns:** the response body

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public JsonNode requestSignature(
        String consentId,
        RequestOptions options) throws IOException, InterruptedException
```

Requests a signature for a consent (`POST /consent/signature/{consentId}`).

**Parameters:**

- `consentId`: the `Consent` id
- `options`: per-request options, such as the timeout

**Returns:** the response body

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

## ConsentResource.LegalConsentResource [#consentresourcelegalconsentresource]

```java
public static final class LegalConsentResource
```

Reads and records the signed-in user's legal consent (`/v1/me/consent/legal`).

### LegalConsentResource.retrieve [#legalconsentresourceretrieve]

```java
public JsonNode retrieve() throws IOException, InterruptedException
```

Reads the signed-in user's legal consent (`GET /v1/me/consent/legal`).

**Returns:** the consent state

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public JsonNode retrieve(RequestOptions options) throws IOException, InterruptedException
```

Reads the signed-in user's legal consent (`GET /v1/me/consent/legal`).

**Parameters:**

- `options`: per-request options, such as the timeout

**Returns:** the consent state

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

### LegalConsentResource.set [#legalconsentresourceset]

```java
public JsonNode set(boolean accepted) throws IOException, InterruptedException
```

Records whether the signed-in user accepts the legal consent (`POST /v1/me/consent/legal`).

**Parameters:**

- `accepted`: whether the user accepts; sent as `termsAndConditionsConsent`

**Returns:** the consent state

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public JsonNode set(
        boolean accepted,
        RequestOptions options) throws IOException, InterruptedException
```

Records whether the signed-in user accepts the legal consent (`POST /v1/me/consent/legal`).

**Parameters:**

- `accepted`: whether the user accepts; sent as `termsAndConditionsConsent`
- `options`: per-request options, such as the timeout

**Returns:** the consent state

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

## ConsentResource.MedicalConsentResource [#consentresourcemedicalconsentresource]

```java
public static final class MedicalConsentResource
```

Reads and records the signed-in user's medical-notifications consent (`/v1/me/consent/medical`).

### MedicalConsentResource.retrieve [#medicalconsentresourceretrieve]

```java
public JsonNode retrieve() throws IOException, InterruptedException
```

Reads the signed-in user's medical-notifications consent (`GET /v1/me/consent/medical`).

**Returns:** the consent state

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public JsonNode retrieve(RequestOptions options) throws IOException, InterruptedException
```

Reads the signed-in user's medical-notifications consent (`GET /v1/me/consent/medical`).

**Parameters:**

- `options`: per-request options, such as the timeout

**Returns:** the consent state

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

### MedicalConsentResource.set [#medicalconsentresourceset]

```java
public JsonNode set(boolean accepted) throws IOException, InterruptedException
```

Records whether the signed-in user accepts the medical-notifications consent (`POST /v1/me/consent/medical`).

**Parameters:**

- `accepted`: whether the user accepts; sent as `medicalSettingsNotificationsConsent`

**Returns:** the consent state

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public JsonNode set(
        boolean accepted,
        RequestOptions options) throws IOException, InterruptedException
```

Records whether the signed-in user accepts the medical-notifications consent (`POST /v1/me/consent/medical`).

**Parameters:**

- `accepted`: whether the user accepts; sent as `medicalSettingsNotificationsConsent`
- `options`: per-request options, such as the timeout

**Returns:** the consent state

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response
