Skip to content

chore(docs): split Read examples in README to separate sections #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 13, 2023
Merged
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
34 changes: 27 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,37 +386,57 @@ Reads the relationship tuples stored in the database. It does not evaluate nor e

```python
# Find if a relationship tuple stating that a certain user is a viewer of certain document
body = TupleKey(
body = ReadRequest(
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation="viewer",
object="document:roadmap",
)

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

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

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

```

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

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

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

// 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("...") })]})
```

```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

Expand Down