cmem_client.repositories.protocols.update_item¤
Protocol interface for repository item update operations.
This module defines the UpdateItemProtocol that repositories can implement to provide item update capabilities. It includes error handling and automatic repository refresh after successful updates.
The protocol handles both DataIntegration (build) and DataPlatform (explore) API error formats, providing consistent error reporting across different Corporate Memory components.
Classes:
- UpdateConfig – Abstract base class for repository item update configurations.
- UpdateItemProtocol – Protocol which allows for updating of existing items.
Attributes:
UpdateConfig¤
Bases: Model, ABC
Abstract base class for repository item update configurations.
Attributes:
- model_config –
UpdateItemConfig_contra¤
UpdateItemConfig_contra = TypeVar('UpdateItemConfig_contra', bound=UpdateConfig, contravariant=True)
UpdateItemProtocol¤
Bases: Protocol[ItemType, UpdateItemConfig_contra]
Protocol which allows for updating of existing items.
Attributes:
- _client (
Client) – Corporate Memory client used for the HTTP requests of this repository. - _dict (
dict[str, ItemType]) – Cached contents of the repository, mapping the key of each item to the item itself. Backs the Mapping interface and is populated byfetch_data(). - _config (
RepositoryConfig) – Describes which endpoint the repository fetches its data from. - _logger (
Logger) – Logger of this repository, created lazily on first access through theloggerproperty as a child of the client logger.
Functions:
- fetch_data – Fetch new data and update the repository
- update_item – Update an existing item in the repository.
fetch_data¤
Fetch new data and update the repository
logger¤
Gets the client logger
update_item¤
Update an existing item in the repository.
Parameters:
- item (
ItemType) – The item to update in the repository. - configuration (
UpdateItemConfig_contra | None) – Optional configuration for the update operation.
Raises:
RepositoryModificationError– If the item does not exist or an error occurs.HTTPError– For any other HTTP error.