Skip to content

Commit bb7b745

Browse files
authored
chore(docs): split Read examples in README to separate sections (#31)
2 parents 1f4c734 + cd83fc3 commit bb7b745

1 file changed

Lines changed: 27 additions & 7 deletions

File tree

README.md

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -386,37 +386,57 @@ Reads the relationship tuples stored in the database. It does not evaluate nor e
386386

387387
```python
388388
# Find if a relationship tuple stating that a certain user is a viewer of certain document
389-
body = TupleKey(
389+
body = ReadRequest(
390390
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
391391
relation="viewer",
392392
object="document:roadmap",
393393
)
394394

395+
response = await api_instance.read(body)
396+
# response = ReadResponse({"tuples": [Tuple({"key": TupleKey({"user":"...","relation":"...","object":"..."}), "timestamp": datetime.fromisoformat("...") })]})
397+
```
398+
399+
```python
395400
# Find all relationship tuples where a certain user has a relationship as any relation to a certain document
396-
body = TupleKey(
401+
body = ReadRequest(
397402
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
398403
object="document:roadmap",
399404
)
400405

406+
response = await api_instance.read(body)
407+
# response = ReadResponse({"tuples": [Tuple({"key": TupleKey({"user":"...","relation":"...","object":"..."}), "timestamp": datetime.fromisoformat("...") })]})
408+
409+
```
410+
411+
```python
401412
# Find all relationship tuples where a certain user is a viewer of any document
402-
body = TupleKey(
413+
body = ReadRequest(
403414
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
404415
relation="viewer",
405416
object="document:",
406417
)
407418

419+
response = await api_instance.read(body)
420+
# response = ReadResponse({"tuples": [Tuple({"key": TupleKey({"user":"...","relation":"...","object":"..."}), "timestamp": datetime.fromisoformat("...") })]})
421+
```
422+
423+
```python
408424
# Find all relationship tuples where any user has a relationship as any relation with a particular document
409-
body = TupleKey(
425+
body = ReadRequest(
410426
object="document:roadmap",
411427
)
412428

413-
// Read all stored relationship tuples
414-
body := ReadRequest()
415-
416429
response = await api_instance.read(body)
417430
# response = ReadResponse({"tuples": [Tuple({"key": TupleKey({"user":"...","relation":"...","object":"..."}), "timestamp": datetime.fromisoformat("...") })]})
418431
```
419432

433+
```python
434+
# Read all stored relationship tuples
435+
body = ReadRequest()
436+
437+
response = await api_instance.read(body)
438+
# response = ReadResponse({"tuples": [Tuple({"key": TupleKey({"user":"...","relation":"...","object":"..."}), "timestamp": datetime.fromisoformat("...") })]})
439+
```
420440

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

0 commit comments

Comments
 (0)