Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions config/clients/go/config.overrides.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"openTelemetryDocumentation": "docs/OpenTelemetry.md",
"targetGoVersion": "1.24.0",
"toolchainGoVersion": "1.25.1",
"supportsStreamedListObjects": "streamed_list_objects",
"files": {
"internal/constants.mustache": {
"destinationFilename": "internal/constants/constants.go",
Expand Down
44 changes: 44 additions & 0 deletions config/clients/go/template/README_calling_api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,50 @@ data, err := fgaClient.ListObjects(context.Background()).
// data.Objects = ["document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a"]
```

##### Streamed List Objects
Comment thread
rhamzeh marked this conversation as resolved.

List objects of a particular type that the user has access to, using the streaming API.

The Streamed ListObjects API is very similar to the ListObjects API, with two key differences:
1. **Streaming Results**: Instead of collecting all objects before returning a response, it streams them to the client as they are collected.
2. **No Pagination Limit**: Returns all results without the 1000-object limit of the standard ListObjects API.

This is particularly useful when querying **computed relations** that may return large result sets.

[API Documentation](https://openfga.dev/api/service#/Relationship%20Queries/StreamedListObjects)

```golang
options := ClientStreamedListObjectsOptions{
// You can rely on the model id set in the configuration or override it for this specific request
AuthorizationModelId: openfga.PtrString("01GAHCE4YVKPQEKZQHT2R89MQV"),
}

body := ClientStreamedListObjectsRequest{
User: "user:anne",
Relation: "can_read",
Type: "document",
}

response, err := fgaClient.StreamedListObjects(context.Background()).Body(body).Options(options).Execute()
if err != nil {
// .. Handle error
}
defer response.Close()

// Consume objects from the stream
var objects []string
for obj := range response.Objects {
objects = append(objects, obj.Object)
}

// Check for any errors during streaming
if err := <-response.Errors; err != nil {
// .. Handle streaming error
}

// objects = ["document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a"]
```

#### List Relations

List the relations a user has on an object.
Expand Down
Loading