Transform broadcaster name into ID

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2021-09-10 19:20:31 +02:00
parent 2b67673e95
commit c59ef05faa
Signed by: luzifer
GPG Key ID: 0066F03ED215AD7D

View File

@ -285,11 +285,16 @@ func (c Client) GetRecentStreamInfo(username string) (string, string, error) {
return payload.Data[0].GameName, payload.Data[0].Title, nil
}
func (c Client) ModifyChannelInformation(ctx context.Context, broadcaster string, game, title *string) error {
func (c Client) ModifyChannelInformation(ctx context.Context, broadcasterName string, game, title *string) error {
if game == nil && title == nil {
return errors.New("netiher game nor title provided")
}
broadcaster, err := c.GetIDForUsername(broadcasterName)
if err != nil {
return errors.Wrap(err, "getting ID for broadcaster name")
}
data := struct {
GameID *string `json:"game_id,omitempty"`
Title *string `json:"title,omitempty"`