Skip to content

Commit

Permalink
Merge pull request #209 from jackmcguire1/fix/terms
Browse files Browse the repository at this point in the history
fix: AddBlockedTerm struct field tags and request issues
  • Loading branch information
nicklaw5 authored Jan 9, 2024
2 parents fc8460c + 9a91ed8 commit 7714798
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions moderation.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ func (c *Client) UnbanUser(params *UnbanUserParams) (*UnbanUserResponse, error)

type BlockedTermsParams struct {
// Required
BroadcasterID string `json:"broadcaster_id"`
ModeratorID string `json:"moderator_id"`
BroadcasterID string `query:"broadcaster_id"`
ModeratorID string `query:"moderator_id"`

// Optional
After string `json:"after"`
First int `json:"first"`
After string `query:"after"`
First int `query:"first"`
}

type BlockedTermsResponse struct {
Expand Down Expand Up @@ -164,8 +164,8 @@ func (c *Client) GetBlockedTerms(params *BlockedTermsParams) (*BlockedTermsRespo
}

type AddBlockedTermParams struct {
BroadcasterID string `json:"broadcaster_id"`
ModeratorID string `json:"moderator_id"`
BroadcasterID string `query:"broadcaster_id"`
ModeratorID string `query:"moderator_id"`
Text string `json:"text"`
}

Expand All @@ -189,7 +189,7 @@ func (c *Client) AddBlockedTerm(params *AddBlockedTermParams) (*AddBlockedTermRe
return nil, errors.New("the term len must be between 2 and 500")
}

resp, err := c.post("/moderation/blocked_terms", &ManyAddBlockedTerms{}, params)
resp, err := c.postAsJSON("/moderation/blocked_terms", &ManyAddBlockedTerms{}, params)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 7714798

Please sign in to comment.