-
Notifications
You must be signed in to change notification settings - Fork 20
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
add support for external ranking vars #154
Conversation
flat_feed_test.go
Outdated
enrichedURL string | ||
}{ | ||
{ | ||
name : "external ranking vars", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
unknown field name in struct literal of type struct{opts []stream.GetActivitiesOption; url string; enrichedURL string} (typecheck)
options.go
Outdated
@@ -105,6 +106,11 @@ func WithRankingScoreVars() GetActivitiesOption { | |||
return GetActivitiesOption{makeRequestOption("withScoreVars", true)} | |||
} | |||
|
|||
func WithExternalRankingVars(externalRankingVars map[string]any) GetActivitiesOption { | |||
js, _ := json.Marshal(externalRankingVars) //TODO err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
commentFormatting: put a space between //
and comment text (gocritic)
…ccepts only encoded json string created by MakeExternalVarJson function
options.go
Outdated
value string | ||
} | ||
|
||
func MakeExternalVarJson(externalRankingVars map[string]any) (jsonString, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
unexported-return: exported func MakeExternalVarJson returns unexported type stream.jsonString, which can be annoying to use (revive)
options.go
Outdated
return jsonString{string(str)}, err | ||
} | ||
|
||
func WithExternalRankingVars(externalVarJson jsonString) GetActivitiesOption { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
var-naming: func parameter externalVarJson should be externalVarJSON (revive)
flat_feed_test.go
Outdated
client, requester := newClient(t) | ||
flat, _ := newFlatFeedWithUserID(client, "123") | ||
|
||
externalVarJson, err := stream.MakeExternalVarJson(map[string]any{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
var-naming: var externalVarJson should be externalVarJSON (revive)
options.go
Outdated
@@ -105,6 +105,11 @@ func WithRankingScoreVars() GetActivitiesOption { | |||
return GetActivitiesOption{makeRequestOption("withScoreVars", true)} | |||
} | |||
|
|||
// externalVarJson should be valid json | |||
func WithExternalRankingVars(externalVarJson string) GetActivitiesOption { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
var-naming: func parameter externalVarJson should be externalVarJSON (revive)
flat_feed_test.go
Outdated
client, requester := newClient(t) | ||
flat, _ := newFlatFeedWithUserID(client, "123") | ||
|
||
externalVarJson, err := json.Marshal(map[string]any{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
var-naming: var externalVarJson should be externalVarJSON (revive)
No description provided.