Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Satori FlagsList to return default flags. #1328

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr
### Changed
- Change FB Limited Login validation Keys URL.
- Update FB Graph API to v22.
- Enable Satori FlagsList to return all default flags.

### Fixed
- Fix chat message listing pagination issue.
Expand Down
16 changes: 10 additions & 6 deletions internal/satori/satori.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ type flagCacheEntry struct {
// @group satori
// @summary List flags.
// @param ctx(type=context.Context) The context object represents information about the server and requester.
// @param id(type=string) The identifier of the identity.
// @param id(type=string) The identifier of the identity. Set to empty string to fetch all default flag values.
// @param names(type=[]string, optional=true, default=[]) Optional list of flag names to filter.
// @return flags(*runtime.FlagList) The flag list.
// @return error(error) An optional error value if an error occurred.
Expand All @@ -609,16 +609,20 @@ func (s *SatoriClient) FlagsList(ctx context.Context, id string, names ...string
if !found {
url := s.url.String() + "/v1/flag"

sessionToken, err := s.generateToken(ctx, id)
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
if err != nil {
return nil, err
}

req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
if err != nil {
return nil, err
if id != "" {
sessionToken, err := s.generateToken(ctx, id)
if err != nil {
return nil, err
}
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", sessionToken))
} else {
req.SetBasicAuth(s.apiKey, "")
}
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", sessionToken))

if len(names) > 0 {
q := req.URL.Query()
Expand Down
2 changes: 1 addition & 1 deletion server/runtime_javascript_nakama.go
Original file line number Diff line number Diff line change
Expand Up @@ -9131,7 +9131,7 @@ func (n *RuntimeJavascriptNakamaModule) satoriExperimentsList(r *goja.Runtime) f

// @group satori
// @summary List flags.
// @param id(type=string) The identifier of the identity.
// @param id(type=string) The identifier of the identity. Set to empty string to fetch all default flag values.
// @param names(type=string[], optional=true, default=[]) Optional list of flag names to filter.
// @return flags(*nkruntime.Flag[]) The flag list.
// @return error(error) An optional error value if an error occurred.
Expand Down
2 changes: 1 addition & 1 deletion server/runtime_lua_nakama.go
Original file line number Diff line number Diff line change
Expand Up @@ -11220,7 +11220,7 @@ func (n *RuntimeLuaNakamaModule) satoriExperimentsList(l *lua.LState) int {

// @group satori
// @summary List flags.
// @param id(type=string) The identifier of the identity.
// @param id(type=string) The identifier of the identity. Set to empty string to fetch all default flag values.
// @param names(type=table, optional=true, default=[]) Optional list of flag names to filter.
// @return flags(table) The flag list.
// @return error(error) An optional error value if an error occurred.
Expand Down
Loading