Relationships¶
Methods for managing relationship edges between persons.
pyclann.client.RelationshipsClient
¶
Methods for the /api/persons/{id}/relationships resource.
add
¶
add(person_id: str, rel_type: RelationshipType | str, related_id: str, *, sibling_type: SiblingType | str | None = None, spouse_from: str | None = None, spouse_to: str | None = None) -> None
Add a relationship between two persons.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
person_id
|
str
|
Full record ID or bare ULID of the subject person. |
required |
rel_type
|
RelationshipType | str
|
|
required |
related_id
|
str
|
Full record ID of the related person ( |
required |
sibling_type
|
SiblingType | str | None
|
|
None
|
spouse_from
|
str | None
|
Optional marriage/partnership start date. |
None
|
spouse_to
|
str | None
|
Optional marriage/partnership end date. |
None
|
Raises:
| Type | Description |
|---|---|
ClannValidationError
|
If |
ClannAuthError
|
If not authenticated. |
get
¶
Return all relationships for a person, grouped by type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
person_id
|
str
|
Full record ID or bare ULID. |
required |
Returns:
| Type | Description |
|---|---|
RelationshipsResponse
|
class: |
Raises:
| Type | Description |
|---|---|
ClannNotFoundError
|
If the person does not exist. |
ClannAuthError
|
If not authenticated. |
remove
¶
Delete a relationship edge.
Spouse edges are bidirectional; both directions are removed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
person_id
|
str
|
Full record ID or bare ULID of the subject person. |
required |
rel_type
|
RelationshipType | str
|
:class: |
required |
related_id
|
str
|
Full record ID of the related person ( |
required |
Raises:
| Type | Description |
|---|---|
ClannValidationError
|
If |
ClannAuthError
|
If not authenticated. |
update_spouse_dates
¶
update_spouse_dates(person_id: str, related_id: str, *, spouse_from: str | None = None, spouse_to: str | None = None) -> None
Update the date attributes on a spouse relationship.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
person_id
|
str
|
Full record ID or bare ULID of the subject person. |
required |
related_id
|
str
|
Full record ID of the spouse ( |
required |
spouse_from
|
str | None
|
New marriage/partnership start date, or |
None
|
spouse_to
|
str | None
|
New marriage/partnership end date, or |
None
|
Raises:
| Type | Description |
|---|---|
ClannAuthError
|
If not authenticated. |
get_family_tree
¶
Return the recursive family-tree view centred on a person.
Goes up to 2 generations deep for ancestors; children, spouses, and siblings of the root are also included.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
person_id
|
str
|
Full record ID or bare ULID. |
required |
Returns:
| Type | Description |
|---|---|
FamilyTreeNode
|
class: |
Raises:
| Type | Description |
|---|---|
ClannNotFoundError
|
If the person does not exist. |
ClannAuthError
|
If not authenticated. |