From 1980c90db9574f3fcdd3a41689bdb0fbc23518b4 Mon Sep 17 00:00:00 2001 From: Anurag Bandyopadhyay Date: Tue, 2 Dec 2025 18:43:11 +0530 Subject: [PATCH 1/3] chore: make streamed list client interface private --- client/client.go | 19 +++---------------- client/streaming_test.go | 12 ++++++------ example/streamed_list_objects/main.go | 11 +++++++++++ 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/client/client.go b/client/client.go index ed9d93e..e31d84a 100644 --- a/client/client.go +++ b/client/client.go @@ -439,19 +439,6 @@ type SdkClient interface { */ ListUsersExecute(r SdkClientListUsersRequestInterface) (*ClientListUsersResponse, error) - /* - * StreamedListObjects Stream all objects of the given type that the user has a relation with - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return SdkClientStreamedListObjectsRequestInterface - */ - StreamedListObjects(ctx _context.Context) SdkClientStreamedListObjectsRequestInterface - - /* - * StreamedListObjectsExecute executes the StreamedListObjects request and returns a channel - * @return *ClientStreamedListObjectsResponse - */ - StreamedListObjectsExecute(request SdkClientStreamedListObjectsRequestInterface) (*ClientStreamedListObjectsResponse, error) - /* Assertions */ /* @@ -3349,7 +3336,7 @@ func (r *ClientStreamedListObjectsResponse) Close() { } } -func (client *OpenFgaClient) StreamedListObjects(ctx _context.Context) SdkClientStreamedListObjectsRequestInterface { +func (client *OpenFgaClient) streamedListObjects(ctx _context.Context) SdkClientStreamedListObjectsRequestInterface { return &SdkClientStreamedListObjectsRequest{ Client: client, ctx: ctx, @@ -3381,7 +3368,7 @@ func (request *SdkClientStreamedListObjectsRequest) Body(body ClientStreamedList } func (request *SdkClientStreamedListObjectsRequest) Execute() (*ClientStreamedListObjectsResponse, error) { - return request.Client.StreamedListObjectsExecute(request) + return request.Client.streamedListObjectsExecute(request) } func (request *SdkClientStreamedListObjectsRequest) GetContext() _context.Context { @@ -3396,7 +3383,7 @@ func (request *SdkClientStreamedListObjectsRequest) GetOptions() *ClientStreamed return request.options } -func (client *OpenFgaClient) StreamedListObjectsExecute(request SdkClientStreamedListObjectsRequestInterface) (*ClientStreamedListObjectsResponse, error) { +func (client *OpenFgaClient) streamedListObjectsExecute(request SdkClientStreamedListObjectsRequestInterface) (*ClientStreamedListObjectsResponse, error) { if request.GetBody() == nil { return nil, FgaRequiredParamError{param: "body"} } diff --git a/client/streaming_test.go b/client/streaming_test.go index d687742..b0a7e1a 100644 --- a/client/streaming_test.go +++ b/client/streaming_test.go @@ -56,7 +56,7 @@ func TestClientStreamedListObjects_Success(t *testing.T) { ctx := context.Background() - response, err := client.StreamedListObjects(ctx). + response, err := client.streamedListObjects(ctx). Body(ClientStreamedListObjectsRequest{ Type: "document", Relation: "viewer", @@ -115,7 +115,7 @@ func TestClientStreamedListObjects_WithOptions(t *testing.T) { ctx := context.Background() consistency := openfga.CONSISTENCYPREFERENCE_HIGHER_CONSISTENCY - response, err := client.StreamedListObjects(ctx). + response, err := client.streamedListObjects(ctx). Body(ClientStreamedListObjectsRequest{ Type: "document", Relation: "viewer", @@ -162,7 +162,7 @@ func TestClientStreamedListObjects_ErrorHandling(t *testing.T) { ctx := context.Background() - _, err = client.StreamedListObjects(ctx). + _, err = client.streamedListObjects(ctx). Body(ClientStreamedListObjectsRequest{ Type: "document", Relation: "viewer", @@ -187,7 +187,7 @@ func TestClientStreamedListObjects_NoStoreId(t *testing.T) { ctx := context.Background() - _, err = client.StreamedListObjects(ctx). + _, err = client.streamedListObjects(ctx). Body(ClientStreamedListObjectsRequest{ Type: "document", Relation: "viewer", @@ -230,7 +230,7 @@ func TestClientStreamedListObjects_CustomBufferSize(t *testing.T) { ctx := context.Background() customBufferSize := 50 - response, err := client.StreamedListObjects(ctx). + response, err := client.streamedListObjects(ctx). Body(ClientStreamedListObjectsRequest{ Type: "document", Relation: "viewer", @@ -297,7 +297,7 @@ func TestClientStreamedListObjects_DefaultBufferSize(t *testing.T) { ctx := context.Background() zeroBufferSize := 0 - response, err := client.StreamedListObjects(ctx). + response, err := client.streamedListObjects(ctx). Body(ClientStreamedListObjectsRequest{ Type: "document", Relation: "viewer", diff --git a/example/streamed_list_objects/main.go b/example/streamed_list_objects/main.go index fe19dba..895641d 100644 --- a/example/streamed_list_objects/main.go +++ b/example/streamed_list_objects/main.go @@ -1,5 +1,15 @@ +// NOTE: This example is currently commented out because streamedListObjects is not publicly accessible +// in the client layer. It may be made public in a future release. + package main +func main() { + // Example temporarily disabled - streamedListObjects is not publicly accessible +} + +/* +// Original example code (commented out): + import ( "context" "encoding/json" @@ -199,3 +209,4 @@ func handleError(err error) { } os.Exit(1) } +*/ From a31ca9c72e17ba637ee932745a17d4136cfc3d14 Mon Sep 17 00:00:00 2001 From: Anurag Bandyopadhyay Date: Tue, 2 Dec 2025 18:46:42 +0530 Subject: [PATCH 2/3] fix: fmt --- example/streamed_list_objects/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/streamed_list_objects/main.go b/example/streamed_list_objects/main.go index 895641d..d701789 100644 --- a/example/streamed_list_objects/main.go +++ b/example/streamed_list_objects/main.go @@ -4,7 +4,7 @@ package main func main() { - // Example temporarily disabled - streamedListObjects is not publicly accessible + // Example temporarily disabled - streamedListObjects is not publicly accessible } /* From e80beafa98b097b0b9695a97e5dbd9aec246b9bd Mon Sep 17 00:00:00 2001 From: Anurag Bandyopadhyay Date: Tue, 2 Dec 2025 18:50:57 +0530 Subject: [PATCH 3/3] feat: remove readme changes for streamed list objecst --- README.md | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) diff --git a/README.md b/README.md index 103f257..d3206bf 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,6 @@ This is an autogenerated Go SDK for OpenFGA. It provides a wrapper around the [O - [Batch Check](#batch-check) - [Expand](#expand) - [List Objects](#list-objects) - - [Streamed List Objects](#streamed-list-objects) - [List Relations](#list-relations) - [List Users](#list-users) - [Assertions](#assertions) @@ -912,51 +911,6 @@ data, err := fgaClient.ListObjects(context.Background()). // data.Objects = ["document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a"] ``` - -##### Streamed List Objects - -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.