Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/aserto/client/directory/v3/aio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,38 +405,41 @@ async def get_relations(
@typing.overload
async def get_relation(
self,
*,
with_objects: typing.Literal[False] = False,
object_type: str = "",
object_id: str = "",
relation: str = "",
subject_type: str = "",
subject_id: str = "",
subject_relation: str = "",
with_objects: typing.Literal[False] = False,
) -> Relation:
...

@typing.overload
async def get_relation(
self,
*,
with_objects: typing.Literal[True],
object_type: str = "",
object_id: str = "",
relation: str = "",
subject_type: str = "",
subject_id: str = "",
subject_relation: str = "",
with_objects: typing.Literal[True] = True,
) -> RelationResponse:
...

async def get_relation(
self,
*,
with_objects: bool = False,
object_type: str = "",
object_id: str = "",
relation: str = "",
subject_type: str = "",
subject_id: str = "",
subject_relation: str = "",
with_objects: bool = False,
) -> typing.Union[Relation, RelationResponse]:
"""Retrieve a directory relation that matches the specified filters.
Raises a NotFoundError no matching relation is found.
Expand Down
7 changes: 6 additions & 1 deletion test/test_directory_v3_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,12 @@ async def test_delete_object(directory: Directory):

# Relations should remain intact
rel = await directory.get_relation(
"user", "morty@the-citadel.com", "manager", "user", "rick@the-citadel"
with_objects=False,
object_type="user",
object_id="morty@the-citadel.com",
relation="manager",
subject_type="user",
subject_id="rick@the-citadel.com",
)
assert rel is not None
assert rel.object_type == "user"
Expand Down
Loading