Skip to content

Life Events

Methods for managing life events per person.

pyclann.client.LifeEventsClient

LifeEventsClient(http: _HttpSession)

Methods for life events (/api/persons/{id}/life-events and /api/life-events).

create

create(person_id: str, name: str, event_type: EventType | str, *, date: str | None = None, description: str | None = None, story: str | None = None, verified: bool = False, source_link: str | None = None, source_image: str | None = None, source_doc: str | None = None, created_by: str | None = None) -> LifeEvent

Add a life event to a person's record.

Parameters:

Name Type Description Default
person_id str

Full record ID or bare ULID.

required
name str

Short name, e.g. "Born in Dublin".

required
event_type EventType | str

One of :class:~pyclann.models.EventType or an arbitrary string.

required
date str | None

ISO 8601 date or free-form string.

None
description str | None

Short description.

None
story str | None

Long-form Markdown narrative.

None
verified bool

Whether this event has been verified from a source.

False
source_link str | None

URL to an external source.

None
source_image str | None

Reference to a source image.

None
source_doc str | None

Reference to a source document.

None
created_by str | None

Username of the creator.

None

Returns:

Type Description
LifeEvent

The newly created :class:~pyclann.models.LifeEvent.

Raises:

Type Description
ClannNotFoundError

If the person does not exist.

ClannAuthError

If not authenticated.

list

list(person_id: str, *, created_by: str | None = None) -> builtins.list[LifeEvent]

Return life events for a person, ordered by date ascending.

Parameters:

Name Type Description Default
person_id str

Full record ID or bare ULID.

required
created_by str | None

Filter by creator username.

None

Returns:

Type Description
list[LifeEvent]

List of :class:~pyclann.models.LifeEvent objects.

Raises:

Type Description
ClannNotFoundError

If the person does not exist.

ClannAuthError

If not authenticated.

get

get(event_id: str) -> LifeEvent

Fetch a single life event.

Parameters:

Name Type Description Default
event_id str

Full record ID ("life_event:01jd4a8xyz") or bare ULID.

required

Returns:

Type Description
LifeEvent

class:~pyclann.models.LifeEvent.

Raises:

Type Description
ClannNotFoundError

If the event does not exist.

ClannAuthError

If not authenticated.

update

update(event_id: str, *, name: str | None = None, date: str | None = None, event_type: EventType | str | None = None, description: str | None = None, story: str | None = None, verified: bool | None = None, source_link: str | None = None, source_image: str | None = None, source_doc: str | None = None) -> LifeEvent

Update a life event; only supplied fields are changed.

Parameters:

Name Type Description Default
event_id str

Full record ID or bare ULID.

required

Returns:

Type Description
LifeEvent

The updated :class:~pyclann.models.LifeEvent.

Raises:

Type Description
ClannNotFoundError

If the event does not exist.

ClannAuthError

If not authenticated.

delete

delete(event_id: str) -> None

Delete a life event.

Parameters:

Name Type Description Default
event_id str

Full record ID or bare ULID.

required

Raises:

Type Description
ClannNotFoundError

If the event does not exist.

ClannAuthError

If not authenticated.