Skip to content

Commit 6e35971

Browse files
authored
Update README.md openfga#26
Edited README.md to create separate code blocks for Read Relationship Tuples example.
1 parent 1f4c734 commit 6e35971

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,33 +391,40 @@ body = TupleKey(
391391
relation="viewer",
392392
object="document:roadmap",
393393
)
394+
```
394395

396+
```python
395397
# Find all relationship tuples where a certain user has a relationship as any relation to a certain document
396398
body = TupleKey(
397399
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
398400
object="document:roadmap",
399401
)
402+
```
400403

404+
```python
401405
# Find all relationship tuples where a certain user is a viewer of any document
402406
body = TupleKey(
403407
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
404408
relation="viewer",
405409
object="document:",
406410
)
411+
```
407412

413+
```python
408414
# Find all relationship tuples where any user has a relationship as any relation with a particular document
409415
body = TupleKey(
410416
object="document:roadmap",
411417
)
418+
```
412419

413-
// Read all stored relationship tuples
420+
```python
421+
# Read all stored relationship tuples
414422
body := ReadRequest()
415423

416424
response = await api_instance.read(body)
417425
# response = ReadResponse({"tuples": [Tuple({"key": TupleKey({"user":"...","relation":"...","object":"..."}), "timestamp": datetime.fromisoformat("...") })]})
418426
```
419427

420-
421428
##### Write (Create and Delete) Relationship Tuples
422429

423430
Create and/or delete relationship tuples to update the system state.

0 commit comments

Comments
 (0)