Enables overriding the store ID using client.go for all APIs except for ListStores and CreateStore.
Description
For endpoints that use the store ID, a StoreId was added to its respective request options. If set, it will be used when making the request. If not set, the store ID configured for the client will be used instead.
client, err := NewSdkClient(&ClientConfiguration{
ApiUrl: os.GetEnv("FGA_API_URL"),
StoreId: os.GetEnv("FGA_STORE_ID"),
})
if err != nil {
// handle error
}
// Uses StoreId from ClientConfiguration
got, err := client.GetStore(context.Background()).Execute()
if err != nil {
// ....
}
fmt.Printf("Got store %v", got.Name)
// store can be overridden
storeOverrideOptions := ClientGetStoreOptions{
StoreId: "01RXYB9SWCFGFCX1QZA9DN8T4Y",
}
got, err = client.GetStore(context.Background()).Options(storeOverrideOptions).Execute()
if err != nil {
// ....
}
fmt.Printf("Got store %v", got.Name)
[ ] I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
[x] The correct base branch is being used, if not main
[x] I have added tests to validate that the change in functionality is working as expected
Enables overriding the store ID using
client.go
for all APIs except for ListStores and CreateStore.Description
For endpoints that use the store ID, a
StoreId
was added to its respective request options. If set, it will be used when making the request. If not set, the store ID configured for the client will be used instead.References
Completes the
go-sdk
work captured in #118Review Checklist
main