Skip to content

Commit 38abcab

Browse files
authored
extended entities() (#248)
* extended entities() * added imports * ran black * ran black
1 parent f1cea62 commit 38abcab

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

src/elimity_insights_client/api/entities/_entities.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import List
1+
from typing import List, Optional, Set
22

33
from elimity_insights_client.api._api import Config
44
from elimity_insights_client.api._api import query as api_query
@@ -10,16 +10,24 @@
1010
from elimity_insights_client.api.entities._query import query
1111

1212

13-
def entities(config: Config, entity_type: EntityType) -> List[Entity]:
13+
def entities(
14+
config: Config,
15+
entity_type: EntityType,
16+
linked_source_ids: Optional[Set[int]] = None,
17+
) -> List[Entity]:
1418
"""
1519
List all entities of the given entity type from the given source.
1620
17-
The resulting entities also include all attribute assignments, and links for every other entity type of the given
18-
source.
21+
The resulting entities also include all attribute assignments, and links for every other entity type
22+
of one of the given linked sources. If linked_source_ids is None, then all other existing sources are used.
1923
"""
2024

2125
sos = sources(config)
22-
schemas = {source.id: source.domain_graph_schema for source in sos}
26+
schemas = {
27+
source.id: source.domain_graph_schema
28+
for source in sos
29+
if linked_source_ids is None or source.id in linked_source_ids
30+
}
2331
que = query(entity_type, schemas)
2432
queries = [que]
2533
(page,) = api_query(config, queries)

0 commit comments

Comments
 (0)