Skip to content
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
30 changes: 25 additions & 5 deletions config/clients/python/template/README_calling_api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ options = {
}
body = ClientReadChangesRequest("document")

response = await api_instance.read_changes(body, options)
response = await fga_client.read_changes(body, options)
# response.continuation_token = ...
# response.changes = [TupleChange(tuple_key=TupleKey(object="...",relation="...",user="..."),operation=TupleOperation("TUPLE_OPERATION_WRITE"),timestamp=datetime.fromisoformat("..."))]
```
Expand All @@ -180,32 +180,52 @@ body = TupleKey(
object="document:roadmap",
)

response = await fga_client.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(
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
object="document:roadmap",
)

response = await fga_client.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(
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
relation="viewer",
object="document:",
)

response = await fga_client.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(
object="document:roadmap",
)

// Read all stored relationship tuples
body := ReadRequest()
response = await fga_client.read(body)
# response = ReadResponse({"tuples": [Tuple({"key": TupleKey({"user":"...","relation":"...","object":"..."}), "timestamp": datetime.fromisoformat("...") })]})
```

```python
# Read all stored relationship tuples
body = TupleKey()

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 Expand Up @@ -441,7 +461,7 @@ body = ClientListObjectsRequest(
]
)

response = await api_instance.list_objects(body)
response = await fga_client.list_objects(body)
# response.objects = ["document:roadmap"]
```

Expand Down