# Omnichannel alerts resource

Canonical page: https://docs.ovok.com/flutter-sdk/reference/ovok_sdk/omnichannel-alerts-resource

{/* Generated by scripts/generate_reference.dart; do not edit. */}

## NotificationsRulesResource [#notificationsrulesresource]

```dart
class NotificationsRulesResource
```

The project's alert notifications rule, JSON Logic passed through as it is.

Reached through `ovok.omnichannelAlerts.rules`.

### Constructors [#constructors]

#### NotificationsRulesResource.new [#notificationsrulesresourcenew]

```dart
NotificationsRulesResource(HttpClient _alerts)
```

Built by `Ovok`; use `ovok.omnichannelAlerts.rules` instead.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `_alerts` | `HttpClient` | positional |  |

### Methods [#methods]

#### NotificationsRulesResource.retrieve [#notificationsrulesresourceretrieve]

```dart
Future<JsonMap> retrieve()
```

Reads the rule under `notifications`, null when the project has none. Calls `GET v1/omnichannel-alerts/rules`.

Returns `Future<Map<String, dynamic>>`.

#### NotificationsRulesResource.update [#notificationsrulesresourceupdate]

```dart
Future<JsonMap> update(JsonMap rule)
```

Sets `rule`, with its JSON Logic under `logic`.

Calls `PUT v1/omnichannel-alerts/rules`. Ovok checks the channels and recipients it names.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `rule` | `JsonMap` | positional |  |

Returns `Future<Map<String, dynamic>>`.

#### NotificationsRulesResource.remove [#notificationsrulesresourceremove]

```dart
Future<void> remove()
```

Removes the rule, so nobody is told of a new alert. Calls `DELETE v1/omnichannel-alerts/rules`.

Returns `Future<void>`.


## OmnichannelAlertsResource [#omnichannelalertsresource]

```dart
class OmnichannelAlertsResource
```

Omni-channel alerts: Ovok runs the project's rule on each Signals alert event, and tells the people it names
by push and email.

Reached through `ovok.omnichannelAlerts`. Every route is under `v1/omnichannel-alerts`. For project admins.

Every request throws an `OvokException` subclass when it fails.

### Constructors [#constructors-1]

#### OmnichannelAlertsResource.new [#omnichannelalertsresourcenew]

```dart
OmnichannelAlertsResource(HttpClient http)
```

Built by `Ovok`; use `ovok.omnichannelAlerts` instead.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `http` | `HttpClient` | positional |  |

### Properties [#properties]

#### OmnichannelAlertsResource.rules [#omnichannelalertsresourcerules]

```dart
final NotificationsRulesResource rules
```

The project's alert notifications rule.

### Methods [#methods-1]

#### OmnichannelAlertsResource.preview [#omnichannelalertsresourcepreview]

```dart
Future<JsonMap> preview(JsonMap preview)
```

Previews who the rule tells of a sample alert event; nothing is sent.

[`preview`](#omnichannelalertsresourcepreview) holds the `patientId`, an optional `event` (`alert.triggered` when omitted), an optional sample
`alert` and an optional `notifications` rule to try. Calls `POST v1/omnichannel-alerts/preview` and answers
the `notify` entries the rule gives, each with the people it reaches.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `preview` | `JsonMap` | positional |  |

Returns `Future<Map<String, dynamic>>`.
