go-twitch/api/moderation/manage_held_automod_message...

50 lines
1.4 KiB
Go

package moderation
import (
"context"
"net/http"
"net/url"
)
type AutoModAction string
const (
AutoModActionAllow AutoModAction = "ALLOW"
AutoModActionDeny AutoModAction = "DENY"
)
type ManageHeldAutoModMessagesRequest struct {
// The moderator who is approving or denying the held message. This ID must match the user ID in the access token.
UserID string `url:"user_id"`
// The ID of the message to allow or deny.
MsgID string `url:"msg_id"`
// The action to take for the message.
Action AutoModAction `url:"action"`
}
// Allow or deny the message that AutoMod flagged for review.
// For information about AutoMod, see How to Use AutoMod: https://help.twitch.tv/s/article/how-to-use-automod
//
// To get messages that AutoMod is holding for review, subscribe to the automod-queue.<moderator_id>.<channel_id> topic using PubSub.
// PubSub sends a notification to your app when AutoMod holds a message for review.
//
// Requires a user access token that includes the moderator:manage:automod scope.
func (m *Moderation) ManageHeldAutoModMessages(ctx context.Context, body *ManageHeldAutoModMessagesRequest) error {
endpoint := m.baseUrl.ResolveReference(&url.URL{Path: "moderation/automod/message"})
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.String(), nil)
if err != nil {
return err
}
res, err := m.client.Do(req)
if err != nil {
return err
}
defer res.Body.Close()
return nil
}