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

add support for external ranking vars #154

Merged
merged 7 commits into from
Jan 9, 2024
Merged

Conversation

itsmeadi
Copy link
Contributor

No description provided.

options.go Outdated Show resolved Hide resolved
enrichedURL string
}{
{
name : "external ranking vars",
Copy link
Contributor

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
Copy link
Contributor

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) {
Copy link
Contributor

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 {
Copy link
Contributor

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)

client, requester := newClient(t)
flat, _ := newFlatFeedWithUserID(client, "123")

externalVarJson, err := stream.MakeExternalVarJson(map[string]any{
Copy link
Contributor

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 {
Copy link
Contributor

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)

client, requester := newClient(t)
flat, _ := newFlatFeedWithUserID(client, "123")

externalVarJson, err := json.Marshal(map[string]any{
Copy link
Contributor

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)

@itsmeadi itsmeadi merged commit bcde016 into main Jan 9, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants