Life Events¶
Methods for managing life events per person.
pyclann.client.LifeEventsClient
¶
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. |
required |
event_type
|
EventType | str
|
One of :class: |
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: |
Raises:
| Type | Description |
|---|---|
ClannNotFoundError
|
If the person does not exist. |
ClannAuthError
|
If not authenticated. |
list
¶
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: |
Raises:
| Type | Description |
|---|---|
ClannNotFoundError
|
If the person does not exist. |
ClannAuthError
|
If not authenticated. |
get
¶
Fetch a single life event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_id
|
str
|
Full record ID ( |
required |
Returns:
| Type | Description |
|---|---|
LifeEvent
|
class: |
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: |
Raises:
| Type | Description |
|---|---|
ClannNotFoundError
|
If the event does not exist. |
ClannAuthError
|
If not authenticated. |
delete
¶
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. |