From b82d5dd0d40e9e4527d26ea036368a8ea9195364 Mon Sep 17 00:00:00 2001 From: bryce Date: Mon, 14 Jul 2025 20:46:35 +1200 Subject: [PATCH] random commit --- internal/twitchapi/client.go | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/internal/twitchapi/client.go b/internal/twitchapi/client.go index 9721104..1bfa3b2 100644 --- a/internal/twitchapi/client.go +++ b/internal/twitchapi/client.go @@ -44,8 +44,8 @@ func (c *Client) GetUserID(login string) (string, error) { return resp.Data.Users[0].ID, nil } -func getStreamInfo(client *helix.Client, userID string) (*helix.Stream, error) { - resp, err := client.GetStreams(&helix.StreamsParams{ +func (c *Client) GetStreamInfo(userID string) (*helix.Stream, error) { + rep, err := c.api.GetStreams(&helix.StreamsParams{ UserIDs: []string{userID}, }) if err != nil { @@ -57,12 +57,12 @@ func getStreamInfo(client *helix.Client, userID string) (*helix.Stream, error) { return &resp.Data.Streams[0], nil } -func getStreamUptime(client *helix.Client, channel string) (string, error) { - userID, err := GetUserID(client, channel) +func (c *Client) GetStreamUptime(channel string) (string, error) { + userID, err := c.GetUserId(channel) if err != nil { return "", err } - stream, err := getStreamInfo(client, userID) + stream, err := c.GetStreamInfo(userID) if err != nil { return "", err } @@ -72,12 +72,12 @@ func getStreamUptime(client *helix.Client, channel string) (string, error) { return uptime.String(), nil } -func getStreamTitle(client *helix.Client, channel string) (string, error) { - userID, err := GetUserID(client, channel) +func (c *Client) GetStreamTitle(channel string) (string, error) { + userID, err := C. GetUserID(channel) if err != nil { return "", err } - resp, err := client.GetChannelInformation(&helix.GetChannelInformationParams{ + resp, err := c.api.GetChannelInformation(&helix.GetChannelInformationParams{ BroadcasterID: userID, }) if err != nil { @@ -89,24 +89,24 @@ func getStreamTitle(client *helix.Client, channel string) (string, error) { return resp.Data.Channels[0].Title, nil } -func setStreamTitle(client *helix.Client, channel, newTitle string) error { - userID, err := GetUserID(client, channel) +func (c *Client) SetStreamTitle(channel, newTitle string) error { + userID, err := c.GetUserID(channel) if err!= nil { return err } - _, err = client.EditChannelInformation(&helix.EditChannelInformationParams { + _, err = c.api.EditChannelInformation(&helix.EditChannelInformationParams { BroadcasterID: userID, Title: newTitle, }) return err } -func getStreamCategory(client *helix.Client, channel string) (string, error) { - userID, err := GetUserID(client, channel) +func (c *Client) GetStreamCategory(channel string) (string, error) { + userID, err := c.GetUserID(channel) if err != nil { return "", err } - resp, err := client.GetChannelInformation(&helix.GetChannelInformationParams{ + resp, err := c.api.GetChannelInformation(&helix.GetChannelInformationParams{ BroadcasterID: userID, }) if err != nil {