Skip to content

Commit

Permalink
Update README.md openfga#26
Browse files Browse the repository at this point in the history
Edited README.md to create separate code blocks for Read Relationship Tuples example.
  • Loading branch information
akj2018 authored Jun 12, 2023
1 parent 1f4c734 commit 6e35971
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,33 +391,40 @@ body = TupleKey(
relation="viewer",
object="document:roadmap",
)
```

```python
# Find all relationship tuples where a certain user has a relationship as any relation to a certain document
body = TupleKey(
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
object="document:roadmap",
)
```

```python
# Find all relationship tuples where a certain user is a viewer of any document
body = TupleKey(
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation="viewer",
object="document:",
)
```

```python
# Find all relationship tuples where any user has a relationship as any relation with a particular document
body = TupleKey(
object="document:roadmap",
)
```

// Read all stored relationship tuples
```python
# Read all stored relationship tuples
body := ReadRequest()

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


##### Write (Create and Delete) Relationship Tuples

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

0 comments on commit 6e35971

Please sign in to comment.