> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# clients

# `prefect.server.events.clients`

## Classes

### `EventsClient` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L37](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L37)</sup>

The abstract interface for a Prefect Events client

**Methods:**

#### `emit` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L41](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L41)</sup>

```python theme={null}
emit(self, event: Event) -> Optional[Event]
```

### `NullEventsClient` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L55](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L55)</sup>

A no-op implementation of the Prefect Events client for testing

**Methods:**

#### `client_name` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L177](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L177)</sup>

```python theme={null}
client_name(self) -> str
```

#### `emit` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L58](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L58)</sup>

```python theme={null}
emit(self, event: Event) -> None
```

#### `emit` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L180](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L180)</sup>

```python theme={null}
emit(self, event: Event) -> None
```

Emit a single event

### `AssertingEventsClient` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L62](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L62)</sup>

An implementation of the Prefect Events client that records all events sent
to it for inspection during tests.

**Methods:**

#### `assert_emitted_event_count` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L112](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L112)</sup>

```python theme={null}
assert_emitted_event_count(cls, count: int) -> None
```

Assert that the given number of events were emitted.

#### `assert_emitted_event_with` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L120](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L120)</sup>

```python theme={null}
assert_emitted_event_with(cls, event: Optional[str] = None, resource: Optional[Dict[str, LabelValue]] = None, related: Optional[List[Dict[str, LabelValue]]] = None, payload: Optional[Dict[str, Any]] = None) -> None
```

Assert that an event was emitted containing the given properties.

#### `assert_no_emitted_event_with` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L199](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L199)</sup>

```python theme={null}
assert_no_emitted_event_with(cls, event: Optional[str] = None, resource: Optional[Dict[str, LabelValue]] = None, related: Optional[List[Dict[str, LabelValue]]] = None, payload: Optional[Dict[str, Any]] = None) -> None
```

#### `client_name` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L177](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L177)</sup>

```python theme={null}
client_name(self) -> str
```

#### `emit` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L85](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L85)</sup>

```python theme={null}
emit(self, event: Event) -> Event
```

#### `emit` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L180](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L180)</sup>

```python theme={null}
emit(self, event: Event) -> None
```

Emit a single event

#### `emitted_events_count` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L108](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L108)</sup>

```python theme={null}
emitted_events_count(cls) -> int
```

#### `reset` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L80](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L80)</sup>

```python theme={null}
reset(cls) -> None
```

Reset all captured instances and their events.  For use this between tests

### `PrefectServerEventsClient` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L214](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L214)</sup>

**Methods:**

#### `client_name` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L177](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L177)</sup>

```python theme={null}
client_name(self) -> str
```

#### `emit` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L232](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L232)</sup>

```python theme={null}
emit(self, event: Event) -> ReceivedEvent
```

#### `emit` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L180](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L180)</sup>

```python theme={null}
emit(self, event: Event) -> None
```

Emit a single event

### `PrefectServerEventsAPIClient` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L244](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L244)</sup>

**Methods:**

#### `pause_automation` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L269](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L269)</sup>

```python theme={null}
pause_automation(self, automation_id: UUID) -> httpx.Response
```

#### `resume_automation` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L274](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/clients.py#L274)</sup>

```python theme={null}
resume_automation(self, automation_id: UUID) -> httpx.Response
```
