# oarepo\_oaipmh\_harvester.oai\_harvester.service

## `oarepo_oaipmh_harvester.oai_harvester.service`

Service layer for OAI-PMH Harvester.

### `OAIHarvesterSearchOptions`

Bases: `SearchOptions`, `SearchOptionsMixin`

Search options for harvesters.

### `RecordLink`

Bases: `Link`

Short cut for writing record links.

#### `vars(record: OAIHarvesterAggregate, link_vars: dict[str, Any]) -> None`

Variables for the URI template.

### `OAIHarvesterServiceConfig`

Bases: `RecordServiceConfig`, `ConfiguratorMixin`

Harvester service configuration.

### `OAIHarvesterService`

Bases: `RecordService`

Harvester service.

#### `oai_harvester_cls: type[OAIHarvesterAggregate]`

Alias for record\_cls.

#### `create(identity: Identity, data: dict[str, Any], uow: UnitOfWork, expand: bool = False, raise_errors: bool = False) -> RecordItem`

Create a new OAI harvester.

#### `search(identity: Identity, params: dict[str, Any] | None = None, search_preference: str | None = None, expand: bool = False, **kwargs: Any) -> RecordList`

Search harvesters.

#### `read(identity: Identity, id_: str, expand: bool = False, action: str = 'read') -> RecordItem`

Retrieve a single harvester.

#### `update(identity: Identity, id_: str, data: dict[str, Any], uow: UnitOfWork, revision_id: int | None = None, expand: bool = False, **kwargs: Any) -> RecordItem`

Update a harvester.

#### `delete(identity: Identity, id_: str, uow: UnitOfWork, revision_id: int | None = None, **kwargs: Any) -> bool`

Delete a harvester from the database and the search index.

#### `rebuild_index(identity: Identity, uow: UnitOfWork | None = None) -> bool`

Reindex all harvesters.

#### `harvest(identity: Identity, id_: str, all_records: bool = True) -> RecordItem`

Start a harvest of the harvester's source.

With `all_records=False` only records changed at the source since the newest OAI datestamp already harvested are harvested (all records if nothing was harvested yet).
