Skip to content

Commit cac63d3

Browse files
authored
Merge pull request #31 from aserto-dev/async-dir
Update async directory client to match sync
2 parents 74fbf0b + 9aeb187 commit cac63d3

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

src/aserto/client/directory/v3/aio/__init__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,38 +405,41 @@ async def get_relations(
405405
@typing.overload
406406
async def get_relation(
407407
self,
408+
*,
409+
with_objects: typing.Literal[False] = False,
408410
object_type: str = "",
409411
object_id: str = "",
410412
relation: str = "",
411413
subject_type: str = "",
412414
subject_id: str = "",
413415
subject_relation: str = "",
414-
with_objects: typing.Literal[False] = False,
415416
) -> Relation:
416417
...
417418

418419
@typing.overload
419420
async def get_relation(
420421
self,
422+
*,
423+
with_objects: typing.Literal[True],
421424
object_type: str = "",
422425
object_id: str = "",
423426
relation: str = "",
424427
subject_type: str = "",
425428
subject_id: str = "",
426429
subject_relation: str = "",
427-
with_objects: typing.Literal[True] = True,
428430
) -> RelationResponse:
429431
...
430432

431433
async def get_relation(
432434
self,
435+
*,
436+
with_objects: bool = False,
433437
object_type: str = "",
434438
object_id: str = "",
435439
relation: str = "",
436440
subject_type: str = "",
437441
subject_id: str = "",
438442
subject_relation: str = "",
439-
with_objects: bool = False,
440443
) -> typing.Union[Relation, RelationResponse]:
441444
"""Retrieve a directory relation that matches the specified filters.
442445
Raises a NotFoundError no matching relation is found.

test/test_directory_v3_async.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,12 @@ async def test_delete_object(directory: Directory):
184184

185185
# Relations should remain intact
186186
rel = await directory.get_relation(
187-
"user", "morty@the-citadel.com", "manager", "user", "rick@the-citadel"
187+
with_objects=False,
188+
object_type="user",
189+
object_id="morty@the-citadel.com",
190+
relation="manager",
191+
subject_type="user",
192+
subject_id="rick@the-citadel.com",
188193
)
189194
assert rel is not None
190195
assert rel.object_type == "user"

0 commit comments

Comments
 (0)