Skip to content

Commit

Permalink
feat(go-sdk): Add MaxParallelRequests option in ListRelations (#365)
Browse files Browse the repository at this point in the history
  • Loading branch information
ewanharris authored May 29, 2024
2 parents 38378f3 + de4de6b commit 8305263
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/clients/go/template/README_calling_api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,8 @@ List the relations a user has on an object.
options := ClientListRelationsOptions{
// You can rely on the model id set in the configuration or override it for this specific request
AuthorizationModelId: {{packageName}}.PtrString("01GAHCE4YVKPQEKZQHT2R89MQV"),
// Max number of requests to issue in parallel, defaults to 10
MaxParallelRequests: openfga.PtrInt32(5),
}
body := ClientListRelationsRequest{
User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
Expand Down
6 changes: 6 additions & 0 deletions config/clients/go/template/client/client.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -2082,6 +2082,7 @@ type ClientListRelationsRequest struct {

type ClientListRelationsOptions struct {
AuthorizationModelId *string `json:"authorization_model_id,omitempty"`
MaxParallelRequests *int32 `json:"max_parallel_requests,omitempty"`
}

type ClientListRelationsResponse struct {
Expand Down Expand Up @@ -2153,12 +2154,17 @@ func (client *{{appShortName}}Client) ListRelationsExecute(request SdkClientList
if err != nil {
return nil, err
}
var maxParallelReqs *int32
if request.GetOptions() != nil {
maxParallelReqs = request.GetOptions().MaxParallelRequests
}
batchResponse, err := client.BatchCheckExecute(&SdkClientBatchCheckRequest{
ctx: request.GetContext(),
Client: client,
body: &batchRequestBody,
options: &ClientBatchCheckOptions{
AuthorizationModelId: authorizationModelId,
MaxParallelRequests: maxParallelReqs,
},
})

Expand Down

0 comments on commit 8305263

Please sign in to comment.