Compare commits
No commits in common. "main" and "v1.1.2" have entirely different histories.
11
CHANGELOG.md
11
CHANGELOG.md
|
@ -1,11 +0,0 @@
|
||||||
# Changelog
|
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
|
||||||
|
|
||||||
## [1.2.1] - 2024-03-08
|
|
||||||
|
|
||||||
### 🐛 Bug Fixes
|
|
||||||
|
|
||||||
- *(devenv)* Fix version variable in release script
|
|
||||||
|
|
||||||
<!-- generated by git-cliff -->
|
|
|
@ -7,8 +7,6 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetAdScheduleResponse struct {
|
type GetAdScheduleResponse struct {
|
||||||
|
@ -41,15 +39,15 @@ type GetAdScheduleData struct {
|
||||||
//
|
//
|
||||||
// Requires a user access token that includes the channel:read:ads scope.
|
// Requires a user access token that includes the channel:read:ads scope.
|
||||||
// The user_id in the user access token must match the broadcaster_id.
|
// The user_id in the user access token must match the broadcaster_id.
|
||||||
func (a *Ads) GetAdSchedule(ctx context.Context, broadcasterID string) (*GetAdScheduleResponse, error) {
|
func (e *Ads) GetAdSchedule(ctx context.Context, broadcasterID string) (*GetAdScheduleResponse, error) {
|
||||||
v := url.Values{"broadcaster_id": {broadcasterID}}
|
endpoint := e.baseUrl.ResolveReference(&url.URL{Path: "channels/ads", RawQuery: "broadcaster_id=" + broadcasterID})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(a.baseUrl, "channels/ads", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := a.client.Do(req)
|
res, err := e.client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,6 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type SnoozeNextAdResponse struct {
|
type SnoozeNextAdResponse struct {
|
||||||
|
@ -33,9 +31,9 @@ type SnoozeNextAdData struct {
|
||||||
// Requires a user access token that includes the channel:manage:ads scope.
|
// Requires a user access token that includes the channel:manage:ads scope.
|
||||||
// The user_id in the user access token must match the broadcaster_id.
|
// The user_id in the user access token must match the broadcaster_id.
|
||||||
func (e *Ads) SnoozeNextAd(ctx context.Context, broadcasterID string) (*SnoozeNextAdResponse, error) {
|
func (e *Ads) SnoozeNextAd(ctx context.Context, broadcasterID string) (*SnoozeNextAdResponse, error) {
|
||||||
v := url.Values{"broadcaster_id": {broadcasterID}}
|
endpoint := e.baseUrl.ResolveReference(&url.URL{Path: "channels/ads/schedule/snooze", RawQuery: "broadcaster_id=" + broadcasterID})
|
||||||
|
|
||||||
req, err := http.NewRequest(http.MethodPost, endpoint.Make(e.baseUrl, "channels/ads/schedule/snooze", v), nil)
|
req, err := http.NewRequest(http.MethodPost, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type StartCommercialRequest struct {
|
type StartCommercialRequest struct {
|
||||||
|
@ -43,7 +42,8 @@ type StartCommercialData struct {
|
||||||
// NOTE: Only the broadcaster may start a commercial; the broadcaster’s editors and moderators may not start commercials on behalf of the broadcaster.
|
// NOTE: Only the broadcaster may start a commercial; the broadcaster’s editors and moderators may not start commercials on behalf of the broadcaster.
|
||||||
//
|
//
|
||||||
// Requires a user access token that includes the channel:edit:commercial scope.
|
// Requires a user access token that includes the channel:edit:commercial scope.
|
||||||
func (a *Ads) StartCommercial(ctx context.Context, body *StartCommercialRequest) (*StartCommercialResponse, error) {
|
func (e *Ads) StartCommercial(ctx context.Context, body *StartCommercialRequest) (*StartCommercialResponse, error) {
|
||||||
|
endpoint := e.baseUrl.ResolveReference(&url.URL{Path: "channels/commercial"})
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
|
|
||||||
|
@ -55,12 +55,12 @@ func (a *Ads) StartCommercial(ctx context.Context, body *StartCommercialRequest)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.Make(a.baseUrl, "channels/commercial"), r)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.String(), r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := a.client.Do(req)
|
res, err := e.client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,10 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
"go.fifitido.net/twitch/api/types"
|
"go.fifitido.net/twitch/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -81,15 +81,16 @@ type ExtensionAnalyticsReport struct {
|
||||||
// Learn More: https://dev.twitch.tv/docs/insights
|
// Learn More: https://dev.twitch.tv/docs/insights
|
||||||
//
|
//
|
||||||
// Requires a user access token that includes the analytics:read:extensions scope.
|
// Requires a user access token that includes the analytics:read:extensions scope.
|
||||||
func (a *Analytics) GetExtensionAnalytics(ctx context.Context, params GetExtensionAnalyticsParams) (*GetExtensionAnalyticsResponse, error) {
|
func (e *Analytics) GetExtensionAnalytics(ctx context.Context, params GetExtensionAnalyticsParams) (*GetExtensionAnalyticsResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := e.baseUrl.ResolveReference(&url.URL{Path: "analytics/extensions", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequest(http.MethodGet, endpoint.Make(a.baseUrl, "analytics/extensions", v), nil)
|
req, err := http.NewRequest(http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := a.client.Do(req)
|
res, err := e.client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,10 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
"go.fifitido.net/twitch/api/types"
|
"go.fifitido.net/twitch/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -82,15 +82,16 @@ type GameAnalyticsReport struct {
|
||||||
// Learn more: https://dev.twitch.tv/docs/insights
|
// Learn more: https://dev.twitch.tv/docs/insights
|
||||||
//
|
//
|
||||||
// Requires a user access token that includes the analytics:read:games scope.
|
// Requires a user access token that includes the analytics:read:games scope.
|
||||||
func (a *Analytics) GetGameAnalytics(ctx context.Context, params GetGameAnalyticsParams) (*GetGameAnalyticsResponse, error) {
|
func (e *Analytics) GetGameAnalytics(ctx context.Context, params GetGameAnalyticsParams) (*GetGameAnalyticsResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := e.baseUrl.ResolveReference(&url.URL{Path: "analytics/games", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(a.baseUrl, "analytics/games", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := a.client.Do(req)
|
res, err := e.client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ const HelixBaseUrl = "https://api.twitch.tv/helix"
|
||||||
type API struct {
|
type API struct {
|
||||||
client *http.Client
|
client *http.Client
|
||||||
baseUrl *url.URL
|
baseUrl *url.URL
|
||||||
Auth *auth.Auth
|
Auth *auth.Client
|
||||||
|
|
||||||
Ads *ads.Ads
|
Ads *ads.Ads
|
||||||
Analytics *analytics.Analytics
|
Analytics *analytics.Analytics
|
||||||
|
@ -73,7 +73,7 @@ type API struct {
|
||||||
Whispers *whispers.Whispers
|
Whispers *whispers.Whispers
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(client *http.Client, baseUrl *url.URL, authClient *auth.Auth) *API {
|
func New(client *http.Client, baseUrl *url.URL, authClient *auth.Client) *API {
|
||||||
return &API{
|
return &API{
|
||||||
client: client,
|
client: client,
|
||||||
baseUrl: baseUrl,
|
baseUrl: baseUrl,
|
||||||
|
@ -117,7 +117,7 @@ func NewDefault(clientId, clientSecret, redirectUri string) *API {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
baseUrl, _ := url.Parse(HelixBaseUrl)
|
baseUrl, _ := url.Parse(HelixBaseUrl)
|
||||||
authClient := auth.NewWithClient(clientId, clientSecret, redirectUri, client)
|
authClient := auth.NewClient(clientId, clientSecret, redirectUri)
|
||||||
|
|
||||||
return New(client, baseUrl, authClient)
|
return New(client, baseUrl, authClient)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,10 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
"go.fifitido.net/twitch/api/types"
|
"go.fifitido.net/twitch/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -71,8 +71,9 @@ type LeaderboardEntry struct {
|
||||||
// Requires a user access token that includes the bits:read scope.
|
// Requires a user access token that includes the bits:read scope.
|
||||||
func (b *Bits) GetBitsLeaderboard(ctx context.Context, params *GetBitsLeaderboardParams) (*GetBitsLeaderboardResponse, error) {
|
func (b *Bits) GetBitsLeaderboard(ctx context.Context, params *GetBitsLeaderboardParams) (*GetBitsLeaderboardResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := b.baseUrl.ResolveReference(&url.URL{Path: "bits/leaderboard", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(b.baseUrl, "bits/leaderboard", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,6 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetCheermotesResponse struct {
|
type GetCheermotesResponse struct {
|
||||||
|
@ -85,9 +83,9 @@ type CheermoteImageSizes struct {
|
||||||
//
|
//
|
||||||
// Requires an app access token or user access token.
|
// Requires an app access token or user access token.
|
||||||
func (b *Bits) GetCheermotes(ctx context.Context, broadcasterID string) (*GetCheermotesResponse, error) {
|
func (b *Bits) GetCheermotes(ctx context.Context, broadcasterID string) (*GetCheermotesResponse, error) {
|
||||||
v := url.Values{"broadcaster_id": {broadcasterID}}
|
endpoint := b.baseUrl.ResolveReference(&url.URL{Path: "bits/cheermotes", RawQuery: "broadcaster_id=" + broadcasterID})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(b.baseUrl, "bits/cheermotes", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,10 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
"go.fifitido.net/twitch/api/types"
|
"go.fifitido.net/twitch/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -98,8 +98,9 @@ type ProductDataCost struct {
|
||||||
// Requires an app access token.
|
// Requires an app access token.
|
||||||
func (b *Bits) GetExtensionTransactions(ctx context.Context, params *GetExtensionTransactionsParams) (*GetExtensionTransactionsResponse, error) {
|
func (b *Bits) GetExtensionTransactions(ctx context.Context, params *GetExtensionTransactionsParams) (*GetExtensionTransactionsResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := b.baseUrl.ResolveReference(&url.URL{Path: "extensions/transactions", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(b.baseUrl, "extensions/transactions", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
"go.fifitido.net/twitch/api/types"
|
"go.fifitido.net/twitch/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -39,8 +39,9 @@ type ContentClassificationLabelData struct {
|
||||||
// Requires an app access token or user access token.
|
// Requires an app access token or user access token.
|
||||||
func (c *CCLS) GetContentClassificationLabels(ctx context.Context, params GetContentClassificationLabelsParams) (*GetContentClassificationLabelsResponse, error) {
|
func (c *CCLS) GetContentClassificationLabels(ctx context.Context, params GetContentClassificationLabelsParams) (*GetContentClassificationLabelsResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "content_classification_labels", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(c.baseUrl, "content_classification_labels", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,6 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type CreateCustomRewardsRequest struct {
|
type CreateCustomRewardsRequest struct {
|
||||||
|
@ -73,7 +71,7 @@ type CreateCustomRewardsResponse struct {
|
||||||
//
|
//
|
||||||
// Requires a user access token that includes the channel:manage:redemptions scope.
|
// Requires a user access token that includes the channel:manage:redemptions scope.
|
||||||
func (c *ChannelPoints) CreateCustomRewards(ctx context.Context, broadcastID string, body *CreateCustomRewardsRequest) (*CreateCustomRewardsResponse, error) {
|
func (c *ChannelPoints) CreateCustomRewards(ctx context.Context, broadcastID string, body *CreateCustomRewardsRequest) (*CreateCustomRewardsResponse, error) {
|
||||||
v := url.Values{"broadcaster_id": {broadcastID}}
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "channel_points/custom_rewards", RawQuery: "broadcaster_id=" + broadcastID})
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
|
|
||||||
|
@ -85,7 +83,7 @@ func (c *ChannelPoints) CreateCustomRewards(ctx context.Context, broadcastID str
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.Make(c.baseUrl, "channel_points/custom_rewards", v), r)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.String(), r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type DeleteCustomRewardParams struct {
|
type DeleteCustomRewardParams struct {
|
||||||
|
@ -25,8 +25,9 @@ type DeleteCustomRewardParams struct {
|
||||||
// Requires a user access token that includes the channel:manage:redemptions scope.
|
// Requires a user access token that includes the channel:manage:redemptions scope.
|
||||||
func (c *ChannelPoints) DeleteCustomReward(ctx context.Context, params *DeleteCustomRewardParams) error {
|
func (c *ChannelPoints) DeleteCustomReward(ctx context.Context, params *DeleteCustomRewardParams) error {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "channel_points/custom_rewards", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, endpoint.Make(c.baseUrl, "channel_points/custom_rewards", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetCustomRewardParams struct {
|
type GetCustomRewardParams struct {
|
||||||
|
@ -38,8 +38,9 @@ type GetCustomRewardResponse struct {
|
||||||
// Requires a user access token that includes the channel:read:redemptions or channel:manage:redemptions scope.
|
// Requires a user access token that includes the channel:read:redemptions or channel:manage:redemptions scope.
|
||||||
func (c *ChannelPoints) GetCustomReward(ctx context.Context, params *GetCustomRewardParams) (*GetCustomRewardResponse, error) {
|
func (c *ChannelPoints) GetCustomReward(ctx context.Context, params *GetCustomRewardParams) (*GetCustomRewardResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "channel_points/custom_rewards", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(c.baseUrl, "channel_points/custom_rewards", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
"go.fifitido.net/twitch/api/types"
|
"go.fifitido.net/twitch/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -54,8 +54,9 @@ type GetCustomRewardRedemptionResponse struct {
|
||||||
// Requires a user access token that includes the channel:read:redemptions or channel:manage:redemptions scope.
|
// Requires a user access token that includes the channel:read:redemptions or channel:manage:redemptions scope.
|
||||||
func (c *ChannelPoints) GetCustomRewardRedemption(ctx context.Context, params *GetCustomRewardRedemptionParams) (*GetCustomRewardRedemptionResponse, error) {
|
func (c *ChannelPoints) GetCustomRewardRedemption(ctx context.Context, params *GetCustomRewardRedemptionParams) (*GetCustomRewardRedemptionResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "channel_points/custom_rewards/redemptions", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(c.baseUrl, "channel_points/custom_rewards/redemptions", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type UpdateCustomRewardParams struct {
|
type UpdateCustomRewardParams struct {
|
||||||
|
@ -83,6 +83,7 @@ type UpdateCustomRewardResponse struct {
|
||||||
// Requires a user access token that includes the channel:manage:redemptions scope.
|
// Requires a user access token that includes the channel:manage:redemptions scope.
|
||||||
func (c *ChannelPoints) UpdateCustomReward(ctx context.Context, params *UpdateCustomRewardParams, body *UpdateCustomRewardRequest) (*UpdateCustomRewardResponse, error) {
|
func (c *ChannelPoints) UpdateCustomReward(ctx context.Context, params *UpdateCustomRewardParams, body *UpdateCustomRewardRequest) (*UpdateCustomRewardResponse, error) {
|
||||||
v, _ := query.Values(body)
|
v, _ := query.Values(body)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "channel_points/custom_rewards", RawQuery: v.Encode()})
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
|
|
||||||
|
@ -94,7 +95,7 @@ func (c *ChannelPoints) UpdateCustomReward(ctx context.Context, params *UpdateCu
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPatch, endpoint.Make(c.baseUrl, "channel_points/custom_rewards", v), r)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPatch, endpoint.String(), r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type UpdateRedemptionStatusParams struct {
|
type UpdateRedemptionStatusParams struct {
|
||||||
|
@ -43,6 +43,7 @@ type UpdateRedemptionStatusResponse struct {
|
||||||
// Requires a user access token that includes the channel:manage:redemptions scope.
|
// Requires a user access token that includes the channel:manage:redemptions scope.
|
||||||
func (c *ChannelPoints) UpdateRedemptionStatus(ctx context.Context, params *UpdateRedemptionStatusParams, body *UpdateRedemptionStatusRequest) (*UpdateRedemptionStatusResponse, error) {
|
func (c *ChannelPoints) UpdateRedemptionStatus(ctx context.Context, params *UpdateRedemptionStatusParams, body *UpdateRedemptionStatusRequest) (*UpdateRedemptionStatusResponse, error) {
|
||||||
v, _ := query.Values(body)
|
v, _ := query.Values(body)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "channel_points/custom_rewards/redemptions", RawQuery: v.Encode()})
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
|
|
||||||
|
@ -54,7 +55,7 @@ func (c *ChannelPoints) UpdateRedemptionStatus(ctx context.Context, params *Upda
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPatch, endpoint.Make(c.baseUrl, "channel_points/custom_rewards/redemptions", v), r)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPatch, endpoint.String(), r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,6 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetChannelEditorsResponse struct {
|
type GetChannelEditorsResponse struct {
|
||||||
|
@ -31,9 +29,9 @@ type ChannelEditor struct {
|
||||||
//
|
//
|
||||||
// Requires a user access token that includes the channel:read:editors scope.
|
// Requires a user access token that includes the channel:read:editors scope.
|
||||||
func (c *Channels) GetChannelEditors(ctx context.Context, broadcasterID string) (*GetChannelEditorsResponse, error) {
|
func (c *Channels) GetChannelEditors(ctx context.Context, broadcasterID string) (*GetChannelEditorsResponse, error) {
|
||||||
v := url.Values{"broadcaster_id": {broadcasterID}}
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "channels/editors", RawQuery: "broadcaster_id=" + broadcasterID})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(c.baseUrl, "channels/editors", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,10 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
"go.fifitido.net/twitch/api/types"
|
"go.fifitido.net/twitch/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -72,8 +72,9 @@ type ChannelFollower struct {
|
||||||
// only the total follower count will be included in the response.
|
// only the total follower count will be included in the response.
|
||||||
func (c *Channels) GetChannelFollowers(ctx context.Context, params *GetChannelFollowersParams) (*GetChannelFollowersResponse, error) {
|
func (c *Channels) GetChannelFollowers(ctx context.Context, params *GetChannelFollowersParams) (*GetChannelFollowersResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "channels/followers", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(c.baseUrl, "channels/followers", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,10 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/ccls"
|
"go.fifitido.net/twitch/api/ccls"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetChannelInformationParams struct {
|
type GetChannelInformationParams struct {
|
||||||
|
@ -71,8 +71,9 @@ type ChannelInformation struct {
|
||||||
// Requires an app access token or user access token.
|
// Requires an app access token or user access token.
|
||||||
func (c *Channels) GetChannelInformation(ctx context.Context, params *GetChannelInformationParams) (*GetChannelInformdationResponse, error) {
|
func (c *Channels) GetChannelInformation(ctx context.Context, params *GetChannelInformationParams) (*GetChannelInformdationResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "channels", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(c.baseUrl, "channels", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,10 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
"go.fifitido.net/twitch/api/types"
|
"go.fifitido.net/twitch/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -63,8 +63,9 @@ type FollowedChannel struct {
|
||||||
// Requires a user access token that includes the user:read:follows scope.
|
// Requires a user access token that includes the user:read:follows scope.
|
||||||
func (c *Channels) GetFollowedChannels(ctx context.Context, params *GetFollowedChannelsParams) (*GetFollowedChannelsResponse, error) {
|
func (c *Channels) GetFollowedChannels(ctx context.Context, params *GetFollowedChannelsParams) (*GetFollowedChannelsResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "users/follows", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(c.baseUrl, "users/follows", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"go.fifitido.net/twitch/api/ccls"
|
"go.fifitido.net/twitch/api/ccls"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ModifyChannelInformationRequest struct {
|
type ModifyChannelInformationRequest struct {
|
||||||
|
@ -56,7 +55,7 @@ type ModifyContentClassificationLabel struct {
|
||||||
//
|
//
|
||||||
// Requires a user access token that includes the channel:manage:broadcast scope.
|
// Requires a user access token that includes the channel:manage:broadcast scope.
|
||||||
func (c *Channels) ModifyChannelInformation(ctx context.Context, broadcasterID string, body *ModifyChannelInformationRequest) error {
|
func (c *Channels) ModifyChannelInformation(ctx context.Context, broadcasterID string, body *ModifyChannelInformationRequest) error {
|
||||||
v := url.Values{"broadcaster_id": {broadcasterID}}
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "channels", RawQuery: "broadcaster_id=" + broadcasterID})
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
|
|
||||||
|
@ -68,7 +67,7 @@ func (c *Channels) ModifyChannelInformation(ctx context.Context, broadcasterID s
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPatch, endpoint.Make(c.baseUrl, "channels", v), r)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPatch, endpoint.String(), r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
"go.fifitido.net/twitch/api/types"
|
"go.fifitido.net/twitch/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -57,9 +56,9 @@ type CharityCampaign struct {
|
||||||
//
|
//
|
||||||
// Requires a user access token that includes the channel:read:charity scope.
|
// Requires a user access token that includes the channel:read:charity scope.
|
||||||
func (c *Charity) GetCharityCampaign(ctx context.Context, broadcasterID string) (*GetCharityCampaignResponse, error) {
|
func (c *Charity) GetCharityCampaign(ctx context.Context, broadcasterID string) (*GetCharityCampaignResponse, error) {
|
||||||
v := url.Values{"broadcaster_id": {broadcasterID}}
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "charity/campaigns", RawQuery: "broadcaster_id=" + broadcasterID})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(c.baseUrl, "charity/campaigns", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
"go.fifitido.net/twitch/api/types"
|
"go.fifitido.net/twitch/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -61,8 +61,9 @@ type CharityCampaignDonation struct {
|
||||||
// Requires a user access token that includes the channel:read:charity scope.
|
// Requires a user access token that includes the channel:read:charity scope.
|
||||||
func (c *Charity) GetCharityCampaignDonations(ctx context.Context, params *GetCharityCampaignDonationsParams) (*GetCharityCampaignDonationsResponse, error) {
|
func (c *Charity) GetCharityCampaignDonations(ctx context.Context, params *GetCharityCampaignDonationsParams) (*GetCharityCampaignDonationsResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "charity/campaigns/donations", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(c.baseUrl, "charity/campaigns/donations", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetChannelChatBadgesResponse struct {
|
type GetChannelChatBadgesResponse struct {
|
||||||
|
@ -22,9 +20,9 @@ type GetChannelChatBadgesResponse struct {
|
||||||
//
|
//
|
||||||
// Requires an app access token or user access token.
|
// Requires an app access token or user access token.
|
||||||
func (c *Chat) GetChannelChatBadges(ctx context.Context, broadcasterID string) (*GetChannelChatBadgesResponse, error) {
|
func (c *Chat) GetChannelChatBadges(ctx context.Context, broadcasterID string) (*GetChannelChatBadgesResponse, error) {
|
||||||
v := url.Values{"broadcaster_id": {broadcasterID}}
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "chat/badges", RawQuery: "broadcaster_id=" + broadcasterID})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(c.baseUrl, "chat/badges", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetChannelEmotesResponse struct {
|
type GetChannelEmotesResponse struct {
|
||||||
|
@ -91,9 +89,9 @@ type ChannelEmote struct {
|
||||||
//
|
//
|
||||||
// Requires an app access token or user access token.
|
// Requires an app access token or user access token.
|
||||||
func (c *Chat) GetChannelEmotes(ctx context.Context, broadcasterID string) (*GetChannelEmotesResponse, error) {
|
func (c *Chat) GetChannelEmotes(ctx context.Context, broadcasterID string) (*GetChannelEmotesResponse, error) {
|
||||||
v := url.Values{"broadcaster_id": {broadcasterID}}
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "chat/emotes", RawQuery: "broadcaster_id=" + broadcasterID})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(c.baseUrl, "chat/emotes", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetChatSettingsParams struct {
|
type GetChatSettingsParams struct {
|
||||||
|
@ -36,8 +36,9 @@ type GetChatSettingsResponse struct {
|
||||||
// Requires an app access token or user access token.
|
// Requires an app access token or user access token.
|
||||||
func (c *Chat) GetChatSettings(ctx context.Context, params *GetChatSettingsParams) (*GetChatSettingsResponse, error) {
|
func (c *Chat) GetChatSettings(ctx context.Context, params *GetChatSettingsParams) (*GetChatSettingsResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "chat/settings", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(c.baseUrl, "chat/settings", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
"go.fifitido.net/twitch/api/types"
|
"go.fifitido.net/twitch/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -63,8 +63,9 @@ type Chatter struct {
|
||||||
// Requires a user access token that includes the moderator:read:chatters scope.
|
// Requires a user access token that includes the moderator:read:chatters scope.
|
||||||
func (c *Chat) GetChatters(ctx context.Context, params *GetChattersParams) (*GetChattersResponse, error) {
|
func (c *Chat) GetChatters(ctx context.Context, params *GetChattersParams) (*GetChattersResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "chat/chatters", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(c.baseUrl, "chat/chatters", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetEmoteSetsParams struct {
|
type GetEmoteSetsParams struct {
|
||||||
|
@ -95,8 +95,9 @@ type EmoteSetEmote struct {
|
||||||
// Requires an app access token or user access token.
|
// Requires an app access token or user access token.
|
||||||
func (c *Chat) GetEmoteSets(ctx context.Context, params *GetEmoteSetsParams) (*GetEmoteSetsResponse, error) {
|
func (c *Chat) GetEmoteSets(ctx context.Context, params *GetEmoteSetsParams) (*GetEmoteSetsResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "chat/emotes/set", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(c.baseUrl, "chat/emotes/set", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetGlobalChatBadgesResponse struct {
|
type GetGlobalChatBadgesResponse struct {
|
||||||
|
@ -19,7 +18,9 @@ type GetGlobalChatBadgesResponse struct {
|
||||||
//
|
//
|
||||||
// Requires an app access token or user access token.
|
// Requires an app access token or user access token.
|
||||||
func (c *Chat) GetGlobalChatBadges(ctx context.Context) (*GetGlobalChatBadgesResponse, error) {
|
func (c *Chat) GetGlobalChatBadges(ctx context.Context) (*GetGlobalChatBadgesResponse, error) {
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(c.baseUrl, "chat/badges/global"), nil)
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "chat/badges/global"})
|
||||||
|
|
||||||
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetGlobalEmotesResponse struct {
|
type GetGlobalEmotesResponse struct {
|
||||||
|
@ -66,7 +65,9 @@ type GlobalEmote struct {
|
||||||
//
|
//
|
||||||
// Requires an app access token or user access token.
|
// Requires an app access token or user access token.
|
||||||
func (c *Chat) GetGlobalEmotes(ctx context.Context) (*GetGlobalEmotesResponse, error) {
|
func (c *Chat) GetGlobalEmotes(ctx context.Context) (*GetGlobalEmotesResponse, error) {
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(c.baseUrl, "chat/emotes/global"), nil)
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "chat/emotes/global"})
|
||||||
|
|
||||||
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetUserChatColorParams struct {
|
type GetUserChatColorParams struct {
|
||||||
|
@ -44,8 +44,9 @@ type UserChatColor struct {
|
||||||
// Requires an app access token or user access token.
|
// Requires an app access token or user access token.
|
||||||
func (c *Chat) GetUserChatColor(ctx context.Context, params *GetUserChatColorParams) (*GetUserChatColorResponse, error) {
|
func (c *Chat) GetUserChatColor(ctx context.Context, params *GetUserChatColorParams) (*GetUserChatColorResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "chat/color", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(c.baseUrl, "chat/color", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
"go.fifitido.net/twitch/api/types"
|
"go.fifitido.net/twitch/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ type SendChatAnnouncementRequest struct {
|
||||||
// Requires a user access token that includes the moderator:manage:announcements scope.
|
// Requires a user access token that includes the moderator:manage:announcements scope.
|
||||||
func (c *Chat) SendChatAnnouncement(ctx context.Context, params *SendChatAnnouncementParams, body *SendChatAnnouncementRequest) error {
|
func (c *Chat) SendChatAnnouncement(ctx context.Context, params *SendChatAnnouncementParams, body *SendChatAnnouncementRequest) error {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "chat/announcements", RawQuery: v.Encode()})
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
|
|
||||||
|
@ -49,7 +50,7 @@ func (c *Chat) SendChatAnnouncement(ctx context.Context, params *SendChatAnnounc
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.Make(c.baseUrl, "chat/announcements", v), r)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.String(), r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type SendChatMessageRequest struct {
|
type SendChatMessageRequest struct {
|
||||||
|
@ -55,6 +54,8 @@ type DropReason struct {
|
||||||
// If app access token used, then additionally requires user:bot scope from chatting user,
|
// If app access token used, then additionally requires user:bot scope from chatting user,
|
||||||
// and either channel:bot scope from broadcaster or moderator status.
|
// and either channel:bot scope from broadcaster or moderator status.
|
||||||
func (c *Chat) SendChatMessage(ctx context.Context, body *SendChatMessageRequest) (*SendChatMessageResponse, error) {
|
func (c *Chat) SendChatMessage(ctx context.Context, body *SendChatMessageRequest) (*SendChatMessageResponse, error) {
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "chat/messages"})
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
@ -65,7 +66,7 @@ func (c *Chat) SendChatMessage(ctx context.Context, body *SendChatMessageRequest
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.Make(c.baseUrl, "chat/messages"), r)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.String(), r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type SendShoutoutParams struct {
|
type SendShoutoutParams struct {
|
||||||
|
@ -39,8 +39,9 @@ type SendShoutoutParams struct {
|
||||||
// Requires a user access token that includes the moderator:manage:shoutouts scope.
|
// Requires a user access token that includes the moderator:manage:shoutouts scope.
|
||||||
func (c *Chat) SendShoutout(ctx context.Context, params *SendShoutoutParams) error {
|
func (c *Chat) SendShoutout(ctx context.Context, params *SendShoutoutParams) error {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "chat/shoutouts", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.Make(c.baseUrl, "chat/shoutouts", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type UpdateChatSettingsParams struct {
|
type UpdateChatSettingsParams struct {
|
||||||
|
@ -94,6 +94,7 @@ type UpdateChatSettingsResponse struct {
|
||||||
// Requires a user access token that includes the moderator:manage:chat_settings scope.
|
// Requires a user access token that includes the moderator:manage:chat_settings scope.
|
||||||
func (c *Chat) UpdateChatSettings(ctx context.Context, params *UpdateChatSettingsParams, body *UpdateChatSettingsRequest) (*UpdateChatSettingsResponse, error) {
|
func (c *Chat) UpdateChatSettings(ctx context.Context, params *UpdateChatSettingsParams, body *UpdateChatSettingsRequest) (*UpdateChatSettingsResponse, error) {
|
||||||
v, _ := query.Values(body)
|
v, _ := query.Values(body)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "chat/settings", RawQuery: v.Encode()})
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
|
|
||||||
|
@ -105,7 +106,7 @@ func (c *Chat) UpdateChatSettings(ctx context.Context, params *UpdateChatSetting
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPatch, endpoint.Make(c.baseUrl, "chat/settings", v), r)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPatch, endpoint.String(), r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type UpdateUserChatColorParams struct {
|
type UpdateUserChatColorParams struct {
|
||||||
|
@ -27,8 +27,9 @@ type UpdateUserChatColorParams struct {
|
||||||
// Requires a user access token that includes the user:manage:chat_color scope.
|
// Requires a user access token that includes the user:manage:chat_color scope.
|
||||||
func (c *Chat) UpdateUserChatColor(ctx context.Context, params *UpdateUserChatColorParams) error {
|
func (c *Chat) UpdateUserChatColor(ctx context.Context, params *UpdateUserChatColorParams) error {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "chat/color", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPut, endpoint.Make(c.baseUrl, "chat/color", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPut, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type CreateConduitsRequest struct {
|
type CreateConduitsRequest struct {
|
||||||
|
@ -23,6 +22,8 @@ type CreateConduitsResponse struct {
|
||||||
//
|
//
|
||||||
// Requires an app access token.
|
// Requires an app access token.
|
||||||
func (c *Conduit) CreateConduits(ctx context.Context, body *CreateConduitsRequest) (*CreateConduitsResponse, error) {
|
func (c *Conduit) CreateConduits(ctx context.Context, body *CreateConduitsRequest) (*CreateConduitsResponse, error) {
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "eventsub/conduits"})
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
@ -33,7 +34,7 @@ func (c *Conduit) CreateConduits(ctx context.Context, body *CreateConduitsReques
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.Make(c.baseUrl, "eventsub/conduits"), r)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.String(), r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Deletes a specified conduit.
|
// Deletes a specified conduit.
|
||||||
|
@ -14,9 +12,9 @@ import (
|
||||||
//
|
//
|
||||||
// Requires an app access token.
|
// Requires an app access token.
|
||||||
func (c *Conduit) DeleteConduit(ctx context.Context, id string) error {
|
func (c *Conduit) DeleteConduit(ctx context.Context, id string) error {
|
||||||
v := url.Values{"id": {id}}
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "eventsub/conduits", RawQuery: "id=" + id})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, endpoint.Make(c.baseUrl, "eventsub/conduits", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
"go.fifitido.net/twitch/api/types"
|
"go.fifitido.net/twitch/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -35,8 +35,9 @@ type GetConduitShardsResponse struct {
|
||||||
// Requires an app access token.
|
// Requires an app access token.
|
||||||
func (c *Conduit) GetConduitShards(ctx context.Context, params *GetConduitShardsParams) (*GetConduitShardsResponse, error) {
|
func (c *Conduit) GetConduitShards(ctx context.Context, params *GetConduitShardsParams) (*GetConduitShardsResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "eventsub/conduits/shards", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(c.baseUrl, "eventsub/conduits/shards", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetConduitsResponse struct {
|
type GetConduitsResponse struct {
|
||||||
|
@ -18,7 +17,9 @@ type GetConduitsResponse struct {
|
||||||
//
|
//
|
||||||
// Requires an app access token.
|
// Requires an app access token.
|
||||||
func (c *Conduit) GetConduits(ctx context.Context) (*GetConduitsResponse, error) {
|
func (c *Conduit) GetConduits(ctx context.Context) (*GetConduitsResponse, error) {
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(c.baseUrl, "eventsub/conduits"), nil)
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "eventsub/conduits"})
|
||||||
|
|
||||||
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
"go.fifitido.net/twitch/api/eventsub"
|
"go.fifitido.net/twitch/api/eventsub"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -69,6 +69,8 @@ type UpdateConduitShardsError struct {
|
||||||
//
|
//
|
||||||
// Requires an app access token.
|
// Requires an app access token.
|
||||||
func (c *Conduit) UpdateConduitShards(ctx context.Context, body *UpdateConduitShardsRequest) (*UpdateConduitShardsResponse, error) {
|
func (c *Conduit) UpdateConduitShards(ctx context.Context, body *UpdateConduitShardsRequest) (*UpdateConduitShardsResponse, error) {
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "eventsub/conduits/shards"})
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
@ -79,7 +81,7 @@ func (c *Conduit) UpdateConduitShards(ctx context.Context, body *UpdateConduitSh
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPatch, endpoint.Make(c.baseUrl, "eventsub/conduits/shards"), r)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPatch, endpoint.String(), r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type UpdateConduitsRequest struct {
|
type UpdateConduitsRequest struct {
|
||||||
|
@ -28,6 +27,8 @@ type UpdateConduitsResponse struct {
|
||||||
//
|
//
|
||||||
// Requires an app access token.
|
// Requires an app access token.
|
||||||
func (c *Conduit) UpdateConduits(ctx context.Context, body *UpdateConduitsRequest) (*UpdateConduitsResponse, error) {
|
func (c *Conduit) UpdateConduits(ctx context.Context, body *UpdateConduitsRequest) (*UpdateConduitsResponse, error) {
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "eventsub/conduits"})
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
@ -38,7 +39,7 @@ func (c *Conduit) UpdateConduits(ctx context.Context, body *UpdateConduitsReques
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPatch, endpoint.Make(c.baseUrl, "eventsub/conduits"), r)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPatch, endpoint.String(), r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
package endpoint
|
|
||||||
|
|
||||||
import (
|
|
||||||
"net/url"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
func Make(baseUrl *url.URL, path string, vals ...url.Values) string {
|
|
||||||
var sb strings.Builder
|
|
||||||
sb.WriteString(baseUrl.String())
|
|
||||||
sb.WriteString("/")
|
|
||||||
sb.WriteString(path)
|
|
||||||
if len(vals) > 0 {
|
|
||||||
sb.WriteString("?")
|
|
||||||
sb.WriteString(vals[0].Encode())
|
|
||||||
}
|
|
||||||
return sb.String()
|
|
||||||
|
|
||||||
}
|
|
|
@ -5,10 +5,10 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
"go.fifitido.net/twitch/api/types"
|
"go.fifitido.net/twitch/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -89,15 +89,16 @@ type Entitlement struct {
|
||||||
// User | game_id | The request returns all entitlements that the specified game granted to the user identified in the access token.
|
// User | game_id | The request returns all entitlements that the specified game granted to the user identified in the access token.
|
||||||
//
|
//
|
||||||
// Requires an app access token or user access token. The client ID in the access token must own the game.
|
// Requires an app access token or user access token. The client ID in the access token must own the game.
|
||||||
func (e *Entitlements) GetDropsEntitlements(ctx context.Context, params *GetDropsEntitlementsParams) (*GetDropsEntitlementsResponse, error) {
|
func (c *Entitlements) GetDropsEntitlements(ctx context.Context, params *GetDropsEntitlementsParams) (*GetDropsEntitlementsResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "entitlements/drops", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(e.baseUrl, "entitlements/drops", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := e.client.Do(req)
|
res, err := c.client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type UpdateDropsEntitlementsRequest struct {
|
type UpdateDropsEntitlementsRequest struct {
|
||||||
|
@ -40,7 +39,9 @@ type UpdateDropsEntitlementsData struct {
|
||||||
// User | Updates all entitlements owned by the user in the access token and where the benefits are owned by the organization in the access token.
|
// User | Updates all entitlements owned by the user in the access token and where the benefits are owned by the organization in the access token.
|
||||||
//
|
//
|
||||||
// Requires an app access token or user access token. The client ID in the access token must own the game.
|
// Requires an app access token or user access token. The client ID in the access token must own the game.
|
||||||
func (e *Entitlements) UpdateDropsEntitlements(ctx context.Context, request *UpdateDropsEntitlementsRequest) (*UpdateDropsEntitlementsResponse, error) {
|
func (c *Entitlements) UpdateDropsEntitlements(ctx context.Context, request *UpdateDropsEntitlementsRequest) (*UpdateDropsEntitlementsResponse, error) {
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "entitlements/drops"})
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
@ -51,12 +52,12 @@ func (e *Entitlements) UpdateDropsEntitlements(ctx context.Context, request *Upd
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPatch, endpoint.Make(e.baseUrl, "entitlements/drops"), r)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPatch, endpoint.String(), r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := e.client.Do(req)
|
res, err := c.client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type CreateEventSubSubscriptionRequest struct {
|
type CreateEventSubSubscriptionRequest struct {
|
||||||
|
@ -52,6 +51,7 @@ type CreateEventSubSubscriptionResponse struct {
|
||||||
// If you use Conduits to receive events, the request must specify an app access token.
|
// If you use Conduits to receive events, the request must specify an app access token.
|
||||||
// The request will fail if you use a user access token.
|
// The request will fail if you use a user access token.
|
||||||
func (e *EventSub) CreateEventSubSubscription(ctx context.Context, body *CreateEventSubSubscriptionRequest) (*CreateEventSubSubscriptionResponse, error) {
|
func (e *EventSub) CreateEventSubSubscription(ctx context.Context, body *CreateEventSubSubscriptionRequest) (*CreateEventSubSubscriptionResponse, error) {
|
||||||
|
endpoint := e.baseUrl.ResolveReference(&url.URL{Path: "eventsub/subscriptions"})
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ func (e *EventSub) CreateEventSubSubscription(ctx context.Context, body *CreateE
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.Make(e.baseUrl, "eventsub/subscriptions"), r)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.String(), r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Deletes an EventSub subscription.
|
// Deletes an EventSub subscription.
|
||||||
|
@ -17,9 +15,9 @@ import (
|
||||||
// If you use WebSockets to receive events, the request must specify a user access token.
|
// If you use WebSockets to receive events, the request must specify a user access token.
|
||||||
// The request will fail if you use an app access token. The token may include any scopes.
|
// The request will fail if you use an app access token. The token may include any scopes.
|
||||||
func (e *EventSub) DeleteEventSubSubscription(ctx context.Context, id string) error {
|
func (e *EventSub) DeleteEventSubSubscription(ctx context.Context, id string) error {
|
||||||
v := url.Values{"id": {id}}
|
endpoint := e.baseUrl.ResolveReference(&url.URL{Path: "eventsub/subscriptions", RawQuery: "id=" + id})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, endpoint.Make(e.baseUrl, "eventsub/subscriptions", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
"go.fifitido.net/twitch/api/types"
|
"go.fifitido.net/twitch/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -58,8 +58,9 @@ type GetEventSubSubscriptionsResponse struct {
|
||||||
// The request will fail if you use an app access token. The token may include any scopes.
|
// The request will fail if you use an app access token. The token may include any scopes.
|
||||||
func (e *EventSub) GetEventSubSubscriptions(ctx context.Context, params *GetEventSubSubscriptionsParams) (*GetEventSubSubscriptionsResponse, error) {
|
func (e *EventSub) GetEventSubSubscriptions(ctx context.Context, params *GetEventSubSubscriptionsParams) (*GetEventSubSubscriptionsResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := e.baseUrl.ResolveReference(&url.URL{Path: "eventsub/subscriptions", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(e.baseUrl, "eventsub/subscriptions", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type CreateExtensionSecretParams struct {
|
type CreateExtensionSecretParams struct {
|
||||||
|
@ -35,15 +35,16 @@ type CreateExtensionSecretResponse struct {
|
||||||
// The signed JWT must include the role, user_id, and exp fields
|
// The signed JWT must include the role, user_id, and exp fields
|
||||||
// (see JWT Schema: https://dev.twitch.tv/docs/extensions/reference/#jwt-schema).
|
// (see JWT Schema: https://dev.twitch.tv/docs/extensions/reference/#jwt-schema).
|
||||||
// The role field must be set to external.
|
// The role field must be set to external.
|
||||||
func (e *Extensions) CreateExtensionSecret(ctx context.Context, params *CreateExtensionSecretParams) (*CreateExtensionSecretResponse, error) {
|
func (c *Extensions) CreateExtensionSecret(ctx context.Context, params *CreateExtensionSecretParams) (*CreateExtensionSecretResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "extensions/jwt/secrets", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.Make(e.baseUrl, "extensions/jwt/secrets", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := e.client.Do(req)
|
res, err := c.client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetExtensionBitsProductsParams struct {
|
type GetExtensionBitsProductsParams struct {
|
||||||
|
@ -23,15 +23,16 @@ type GetExtensionBitsProductsResponse struct {
|
||||||
// Gets the list of Bits products that belongs to the extension. The client ID in the app access token identifies the extension.
|
// Gets the list of Bits products that belongs to the extension. The client ID in the app access token identifies the extension.
|
||||||
//
|
//
|
||||||
// Requires an app access token. The client ID in the app access token must be the extension’s client ID.
|
// Requires an app access token. The client ID in the app access token must be the extension’s client ID.
|
||||||
func (e *Extensions) GetExtensionBitsProducts(ctx context.Context, params *GetExtensionBitsProductsParams) (*GetExtensionBitsProductsResponse, error) {
|
func (c *Extensions) GetExtensionBitsProducts(ctx context.Context, params *GetExtensionBitsProductsParams) (*GetExtensionBitsProductsResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "bits/extensions", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(e.baseUrl, "bits/extensions", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := e.client.Do(req)
|
res, err := c.client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetExtensionConfigurationSegmentParams struct {
|
type GetExtensionConfigurationSegmentParams struct {
|
||||||
|
@ -58,15 +58,16 @@ type ConfigurationSegmentData struct {
|
||||||
// The signed JWT must include the role, user_id, and exp fields
|
// The signed JWT must include the role, user_id, and exp fields
|
||||||
// (see JWT Schema: https://dev.twitch.tv/docs/extensions/reference/#jwt-schema).
|
// (see JWT Schema: https://dev.twitch.tv/docs/extensions/reference/#jwt-schema).
|
||||||
// The role field must be set to external.
|
// The role field must be set to external.
|
||||||
func (e *Extensions) GetExtensionConfigurationSegment(ctx context.Context, params *GetExtensionConfigurationSegmentParams) (*GetExtensionConfigurationSegmentResponse, error) {
|
func (c *Extensions) GetExtensionConfigurationSegment(ctx context.Context, params *GetExtensionConfigurationSegmentParams) (*GetExtensionConfigurationSegmentResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "extensions/configurations", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(e.baseUrl, "extensions/configurations", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := e.client.Do(req)
|
res, err := c.client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
"go.fifitido.net/twitch/api/types"
|
"go.fifitido.net/twitch/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -50,15 +50,16 @@ type ExtensionLiveChannel struct {
|
||||||
// It may take a few minutes for the list to include or remove broadcasters that have recently gone live or stopped broadcasting.
|
// It may take a few minutes for the list to include or remove broadcasters that have recently gone live or stopped broadcasting.
|
||||||
//
|
//
|
||||||
// Requires an app access token or user access token.
|
// Requires an app access token or user access token.
|
||||||
func (e *Extensions) GetExtensionLiveChannels(ctx context.Context, params *GetExtensionLiveChannelsParams) (*GetExtensionLiveChannelsResponse, error) {
|
func (c *Extensions) GetExtensionLiveChannels(ctx context.Context, params *GetExtensionLiveChannelsParams) (*GetExtensionLiveChannelsResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "extensions/live", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(e.baseUrl, "extensions/live", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := e.client.Do(req)
|
res, err := c.client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetExtensionSecretsResponse struct {
|
type GetExtensionSecretsResponse struct {
|
||||||
|
@ -22,15 +20,15 @@ type GetExtensionSecretsResponse struct {
|
||||||
// The signed JWT must include the role, user_id, and exp fields
|
// The signed JWT must include the role, user_id, and exp fields
|
||||||
// (see JWT Schema: https://dev.twitch.tv/docs/extensions/reference/#jwt-schema).
|
// (see JWT Schema: https://dev.twitch.tv/docs/extensions/reference/#jwt-schema).
|
||||||
// The role field must be set to external.
|
// The role field must be set to external.
|
||||||
func (e *Extensions) GetExtensionSecrets(ctx context.Context, extensionID string) (*GetExtensionSecretsResponse, error) {
|
func (c *Extensions) GetExtensionSecrets(ctx context.Context, extensionID string) (*GetExtensionSecretsResponse, error) {
|
||||||
v := url.Values{"extension_id": {extensionID}}
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "extensions/jwt/secrets", RawQuery: "extension_id=" + extensionID})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(e.baseUrl, "extensions/jwt/secrets", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := e.client.Do(req)
|
res, err := c.client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetExtensionsParams struct {
|
type GetExtensionsParams struct {
|
||||||
|
@ -31,15 +31,16 @@ type GetExtensionsResponse struct {
|
||||||
// The signed JWT must include the role, user_id, and exp fields
|
// The signed JWT must include the role, user_id, and exp fields
|
||||||
// (see JWT Schema: https://dev.twitch.tv/docs/extensions/reference/#jwt-schema).
|
// (see JWT Schema: https://dev.twitch.tv/docs/extensions/reference/#jwt-schema).
|
||||||
// The role field must be set to external.
|
// The role field must be set to external.
|
||||||
func (e *Extensions) GetExtensions(ctx context.Context, params *GetExtensionsParams) (*GetExtensionsResponse, error) {
|
func (c *Extensions) GetExtensions(ctx context.Context, params *GetExtensionsParams) (*GetExtensionsResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "extensions", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(e.baseUrl, "extensions", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := e.client.Do(req)
|
res, err := c.client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetReleasedExtensionsParams struct {
|
type GetReleasedExtensionsParams struct {
|
||||||
|
@ -26,15 +26,16 @@ type GetReleasedExtensionsResponse struct {
|
||||||
// Gets information about a released extension. Returns the extension if its state is Released.
|
// Gets information about a released extension. Returns the extension if its state is Released.
|
||||||
//
|
//
|
||||||
// Requires an app access token or user access token.
|
// Requires an app access token or user access token.
|
||||||
func (e *Extensions) GetReleasedExtensions(ctx context.Context, params *GetReleasedExtensionsParams) (*GetReleasedExtensionsResponse, error) {
|
func (c *Extensions) GetReleasedExtensions(ctx context.Context, params *GetReleasedExtensionsParams) (*GetReleasedExtensionsResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "extensions/released", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(e.baseUrl, "extensions/released", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := e.client.Do(req)
|
res, err := c.client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,6 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type SendExtensionChatMessageRequest struct {
|
type SendExtensionChatMessageRequest struct {
|
||||||
|
@ -33,8 +31,8 @@ type SendExtensionChatMessageRequest struct {
|
||||||
// The signed JWT must include the role, user_id, and exp fields
|
// The signed JWT must include the role, user_id, and exp fields
|
||||||
// (see JWT Schema: https://dev.twitch.tv/docs/extensions/reference/#jwt-schema).
|
// (see JWT Schema: https://dev.twitch.tv/docs/extensions/reference/#jwt-schema).
|
||||||
// The role field must be set to external.
|
// The role field must be set to external.
|
||||||
func (e *Extensions) SendExtensionChatMessage(ctx context.Context, broadcasterID string, body *SendExtensionChatMessageRequest) error {
|
func (c *Extensions) SendExtensionChatMessage(ctx context.Context, broadcasterID string, body *SendExtensionChatMessageRequest) error {
|
||||||
v := url.Values{"broadcaster_id": {broadcasterID}}
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "extensions/chat", RawQuery: "broadcaster_id=" + broadcasterID})
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
|
|
||||||
|
@ -46,12 +44,12 @@ func (e *Extensions) SendExtensionChatMessage(ctx context.Context, broadcasterID
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.Make(e.baseUrl, "extensions/chat", v), r)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.String(), r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := e.client.Do(req)
|
res, err := c.client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type SendExtensionPubsubMessageRequest struct {
|
type SendExtensionPubsubMessageRequest struct {
|
||||||
|
@ -43,7 +42,9 @@ type SendExtensionPubsubMessageRequest struct {
|
||||||
// To send the message to a specific channel, set the channel_id field in the JWT to the channel’s ID and set the pubsub_perms.send array to broadcast.
|
// To send the message to a specific channel, set the channel_id field in the JWT to the channel’s ID and set the pubsub_perms.send array to broadcast.
|
||||||
//
|
//
|
||||||
// To send the message to all channels on which your extension is active, set the channel_id field to all and set the pubsub_perms.send array to global.
|
// To send the message to all channels on which your extension is active, set the channel_id field to all and set the pubsub_perms.send array to global.
|
||||||
func (e *Extensions) SendExtensionPubsubMessage(ctx context.Context, body *SendExtensionPubsubMessageRequest) error {
|
func (c *Extensions) SendExtensionPubsubMessage(ctx context.Context, body *SendExtensionPubsubMessageRequest) error {
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "extensions/pubsub"})
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
@ -54,12 +55,12 @@ func (e *Extensions) SendExtensionPubsubMessage(ctx context.Context, body *SendE
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.Make(e.baseUrl, "extensions/pubsub"), r)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.String(), r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := e.client.Do(req)
|
res, err := c.client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type SetExtensionConfigurationSegmentRequest struct {
|
type SetExtensionConfigurationSegmentRequest struct {
|
||||||
|
@ -39,7 +38,8 @@ type SetExtensionConfigurationSegmentRequest struct {
|
||||||
// The signed JWT must include the role, user_id, and exp fields
|
// The signed JWT must include the role, user_id, and exp fields
|
||||||
// (see JWT Schema: https://dev.twitch.tv/docs/extensions/reference/#jwt-schema).
|
// (see JWT Schema: https://dev.twitch.tv/docs/extensions/reference/#jwt-schema).
|
||||||
// The role field must be set to external.
|
// The role field must be set to external.
|
||||||
func (e *Extensions) SetExtensionConfigurationSegment(ctx context.Context, body *SetExtensionConfigurationSegmentRequest) error {
|
func (c *Extensions) SetExtensionConfigurationSegment(ctx context.Context, body *SetExtensionConfigurationSegmentRequest) error {
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "extensions/configurations"})
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
|
|
||||||
|
@ -51,12 +51,12 @@ func (e *Extensions) SetExtensionConfigurationSegment(ctx context.Context, body
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPut, endpoint.Make(e.baseUrl, "extensions/configurations"), r)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPut, endpoint.String(), r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := e.client.Do(req)
|
res, err := c.client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,6 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type SetExtensionRequiredConfigurationRequest struct {
|
type SetExtensionRequiredConfigurationRequest struct {
|
||||||
|
@ -34,8 +32,8 @@ type SetExtensionRequiredConfigurationRequest struct {
|
||||||
// The signed JWT must include the role, user_id, and exp fields
|
// The signed JWT must include the role, user_id, and exp fields
|
||||||
// (see JWT Schema: https://dev.twitch.tv/docs/extensions/reference/#jwt-schema).
|
// (see JWT Schema: https://dev.twitch.tv/docs/extensions/reference/#jwt-schema).
|
||||||
// Set the role field to external and the user_id field to the ID of the user that owns the extension.
|
// Set the role field to external and the user_id field to the ID of the user that owns the extension.
|
||||||
func (e *Extensions) SetExtensionRequiredConfiguration(ctx context.Context, broadcasterID string, body *SetExtensionRequiredConfigurationRequest) error {
|
func (c *Extensions) SetExtensionRequiredConfiguration(ctx context.Context, broadcasterID string, body *SetExtensionRequiredConfigurationRequest) error {
|
||||||
v := url.Values{"broadcaster_id": {broadcasterID}}
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "extensions/required_configuration", RawQuery: "broadcaster_id=" + broadcasterID})
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
|
|
||||||
|
@ -47,12 +45,12 @@ func (e *Extensions) SetExtensionRequiredConfiguration(ctx context.Context, broa
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPut, endpoint.Make(e.baseUrl, "extensions/required_configuration", v), r)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPut, endpoint.String(), r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := e.client.Do(req)
|
res, err := c.client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type UpdateExtensionBitsProductRequest struct {
|
type UpdateExtensionBitsProductRequest struct {
|
||||||
|
@ -53,7 +52,9 @@ type UpdateExtensionBitsProductResponse struct {
|
||||||
// If the SKU doesn’t exist, the product is added. You may update all fields except the sku field.
|
// If the SKU doesn’t exist, the product is added. You may update all fields except the sku field.
|
||||||
//
|
//
|
||||||
// Requires an app access token. The client ID in the app access token must match the extension’s client ID.
|
// Requires an app access token. The client ID in the app access token must match the extension’s client ID.
|
||||||
func (e *Extensions) UpdateExtensionBitsProduct(ctx context.Context, body *UpdateExtensionBitsProductRequest) (*UpdateExtensionBitsProductResponse, error) {
|
func (c *Extensions) UpdateExtensionBitsProduct(ctx context.Context, body *UpdateExtensionBitsProductRequest) (*UpdateExtensionBitsProductResponse, error) {
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "bits/extensions"})
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
@ -64,12 +65,12 @@ func (e *Extensions) UpdateExtensionBitsProduct(ctx context.Context, body *Updat
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPut, endpoint.Make(e.baseUrl, "bits/extensions"), r)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPut, endpoint.String(), r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := e.client.Do(req)
|
res, err := c.client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetGamesParams struct {
|
type GetGamesParams struct {
|
||||||
|
@ -35,15 +35,16 @@ type GetGamesResponse struct {
|
||||||
// You may get up to 100 categories or games by specifying their ID or name. You may specify all IDs, all names, or a combination of IDs and names. If you specify a combination of IDs and names, the total number of IDs and names must not exceed 100.
|
// You may get up to 100 categories or games by specifying their ID or name. You may specify all IDs, all names, or a combination of IDs and names. If you specify a combination of IDs and names, the total number of IDs and names must not exceed 100.
|
||||||
//
|
//
|
||||||
// Requires an app access token or user access token.
|
// Requires an app access token or user access token.
|
||||||
func (g *Games) GetGames(ctx context.Context, params *GetGamesParams) (*GetGamesResponse, error) {
|
func (c *Games) GetGames(ctx context.Context, params *GetGamesParams) (*GetGamesResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "games", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(g.baseUrl, "games", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := g.client.Do(req)
|
res, err := c.client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
"go.fifitido.net/twitch/api/types"
|
"go.fifitido.net/twitch/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -38,15 +38,16 @@ type GetTopGamesResponse struct {
|
||||||
// Gets information about all broadcasts on Twitch.
|
// Gets information about all broadcasts on Twitch.
|
||||||
//
|
//
|
||||||
// Requires an app access token or user access token.
|
// Requires an app access token or user access token.
|
||||||
func (g *Games) GetTopGames(ctx context.Context, params *GetTopGamesParams) (*GetTopGamesResponse, error) {
|
func (c *Games) GetTopGames(ctx context.Context, params *GetTopGamesParams) (*GetTopGamesResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "games/top", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(g.baseUrl, "games/top", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := g.client.Do(req)
|
res, err := c.client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,6 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetCreatorGoalsResponse struct {
|
type GetCreatorGoalsResponse struct {
|
||||||
|
@ -84,15 +82,15 @@ type Goal struct {
|
||||||
// using the channel.goal.progress subscription type. Read More: https://dev.twitch.tv/docs/api/goals#requesting-event-notifications
|
// using the channel.goal.progress subscription type. Read More: https://dev.twitch.tv/docs/api/goals#requesting-event-notifications
|
||||||
//
|
//
|
||||||
// Requires a user access token that includes the channel:read:goals scope.
|
// Requires a user access token that includes the channel:read:goals scope.
|
||||||
func (g *Goals) GetCreatorGoals(ctx context.Context, broadcasterID string) (*GetCreatorGoalsResponse, error) {
|
func (c *Goals) GetCreatorGoals(ctx context.Context, broadcasterID string) (*GetCreatorGoalsResponse, error) {
|
||||||
v := url.Values{"broadcaster_id": {broadcasterID}}
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "goals", RawQuery: "broadcaster_id=" + broadcasterID})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(g.baseUrl, "goals", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := g.client.Do(req)
|
res, err := c.client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type AssignGuestStarSlot struct {
|
type AssignGuestStarSlot struct {
|
||||||
|
@ -35,8 +35,9 @@ type AssignGuestStarSlot struct {
|
||||||
// Requires OAuth Scope: channel:manage:guest_star or moderator:manage:guest_star
|
// Requires OAuth Scope: channel:manage:guest_star or moderator:manage:guest_star
|
||||||
func (g *GuestStar) AssignGuestStarSlot(ctx context.Context, params *AssignGuestStarSlot) error {
|
func (g *GuestStar) AssignGuestStarSlot(ctx context.Context, params *AssignGuestStarSlot) error {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := g.baseUrl.ResolveReference(&url.URL{Path: "guest_star/slot", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.Make(g.baseUrl, "guest_star/slot", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type CreateGuestStarSessionResponse struct {
|
type CreateGuestStarSessionResponse struct {
|
||||||
|
@ -20,9 +18,9 @@ type CreateGuestStarSessionResponse struct {
|
||||||
// Query parameter broadcaster_id must match the user_id in the User-Access token
|
// Query parameter broadcaster_id must match the user_id in the User-Access token
|
||||||
// Requires OAuth Scope: channel:manage:guest_star
|
// Requires OAuth Scope: channel:manage:guest_star
|
||||||
func (g *GuestStar) CreateGuestStarSession(ctx context.Context, broadcasterID string) (*CreateGuestStarSessionResponse, error) {
|
func (g *GuestStar) CreateGuestStarSession(ctx context.Context, broadcasterID string) (*CreateGuestStarSessionResponse, error) {
|
||||||
v := url.Values{"broadcaster_id": {broadcasterID}}
|
endpoint := g.baseUrl.ResolveReference(&url.URL{Path: "guest_star/session", RawQuery: url.Values{"broadcaster_id": {broadcasterID}}.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.Make(g.baseUrl, "guest_star/session", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type DeleteGuestStarInviteParams struct {
|
type DeleteGuestStarInviteParams struct {
|
||||||
|
@ -30,8 +30,9 @@ type DeleteGuestStarInviteParams struct {
|
||||||
// Requires OAuth Scope: channel:manage:guest_star or moderator:manage:guest_star
|
// Requires OAuth Scope: channel:manage:guest_star or moderator:manage:guest_star
|
||||||
func (g *GuestStar) DeleteGuestStarInvite(ctx context.Context, params *DeleteGuestStarInviteParams) error {
|
func (g *GuestStar) DeleteGuestStarInvite(ctx context.Context, params *DeleteGuestStarInviteParams) error {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := g.baseUrl.ResolveReference(&url.URL{Path: "guest_star/invite", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, endpoint.Make(g.baseUrl, "guest_star/invite", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type DeleteGuestStarSlotParams struct {
|
type DeleteGuestStarSlotParams struct {
|
||||||
|
@ -37,8 +37,9 @@ type DeleteGuestStarSlotParams struct {
|
||||||
// Requires OAuth Scope: channel:manage:guest_star or moderator:manage:guest_star
|
// Requires OAuth Scope: channel:manage:guest_star or moderator:manage:guest_star
|
||||||
func (g *GuestStar) DeleteGuestStarSlot(ctx context.Context, params *DeleteGuestStarSlotParams) error {
|
func (g *GuestStar) DeleteGuestStarSlot(ctx context.Context, params *DeleteGuestStarSlotParams) error {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := g.baseUrl.ResolveReference(&url.URL{Path: "guest_star/slot", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, endpoint.Make(g.baseUrl, "guest_star/slot", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type EndGuestStarSession struct {
|
type EndGuestStarSession struct {
|
||||||
|
@ -30,8 +30,9 @@ type EndGuestStarSessionResponse struct {
|
||||||
// Requires OAuth Scope: channel:manage:guest_star
|
// Requires OAuth Scope: channel:manage:guest_star
|
||||||
func (g *GuestStar) EndGuestStarSession(ctx context.Context, params *EndGuestStarSession) (*EndGuestStarSessionResponse, error) {
|
func (g *GuestStar) EndGuestStarSession(ctx context.Context, params *EndGuestStarSession) (*EndGuestStarSessionResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := g.baseUrl.ResolveReference(&url.URL{Path: "guest_star/session", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, endpoint.Make(g.baseUrl, "guest_star/session", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetChannelGuestStarSettingsParams struct {
|
type GetChannelGuestStarSettingsParams struct {
|
||||||
|
@ -29,8 +29,9 @@ type GetChannelGuestStarSettingsResponse struct {
|
||||||
// Requires OAuth Scope: channel:read:guest_star, channel:manage:guest_star, moderator:read:guest_star or moderator:manage:guest_star
|
// Requires OAuth Scope: channel:read:guest_star, channel:manage:guest_star, moderator:read:guest_star or moderator:manage:guest_star
|
||||||
func (g *GuestStar) GetChannelGuestStarSettings(ctx context.Context, params *GetChannelGuestStarSettingsParams) (*GetChannelGuestStarSettingsResponse, error) {
|
func (g *GuestStar) GetChannelGuestStarSettings(ctx context.Context, params *GetChannelGuestStarSettingsParams) (*GetChannelGuestStarSettingsResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := g.baseUrl.ResolveReference(&url.URL{Path: "guest_star/channel_settings", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(g.baseUrl, "guest_star/channel_settings", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetGuestStarInvitesParams struct {
|
type GetGuestStarInvitesParams struct {
|
||||||
|
@ -33,8 +33,9 @@ type GetGuestStarInvitesResponse struct {
|
||||||
// Requires OAuth Scope: channel:read:guest_star, channel:manage:guest_star, moderator:read:guest_star or moderator:manage:guest_star
|
// Requires OAuth Scope: channel:read:guest_star, channel:manage:guest_star, moderator:read:guest_star or moderator:manage:guest_star
|
||||||
func (g *GuestStar) GetGuestStarInvites(ctx context.Context, params *GetGuestStarInvitesParams) (*GetGuestStarInvitesResponse, error) {
|
func (g *GuestStar) GetGuestStarInvites(ctx context.Context, params *GetGuestStarInvitesParams) (*GetGuestStarInvitesResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := g.baseUrl.ResolveReference(&url.URL{Path: "guest_star/invites", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(g.baseUrl, "guest_star/invites", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetGuestStarSessionParams struct {
|
type GetGuestStarSessionParams struct {
|
||||||
|
@ -30,8 +30,9 @@ type GetGuestStarSessionResponse struct {
|
||||||
// Guests must be either invited or assigned a slot within the session
|
// Guests must be either invited or assigned a slot within the session
|
||||||
func (g *GuestStar) GetGuestStarSession(ctx context.Context, params *GetGuestStarSessionParams) (*GetGuestStarSessionResponse, error) {
|
func (g *GuestStar) GetGuestStarSession(ctx context.Context, params *GetGuestStarSessionParams) (*GetGuestStarSessionResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := g.baseUrl.ResolveReference(&url.URL{Path: "guest_star/session", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(g.baseUrl, "guest_star/session", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type SendGuestStarInviteParams struct {
|
type SendGuestStarInviteParams struct {
|
||||||
|
@ -30,8 +30,9 @@ type SendGuestStarInviteParams struct {
|
||||||
// Requires OAuth Scope: channel:manage:guest_star or moderator:manage:guest_star
|
// Requires OAuth Scope: channel:manage:guest_star or moderator:manage:guest_star
|
||||||
func (g *GuestStar) SendGuestStarInvite(ctx context.Context, params *SendGuestStarInviteParams) error {
|
func (g *GuestStar) SendGuestStarInvite(ctx context.Context, params *SendGuestStarInviteParams) error {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := g.baseUrl.ResolveReference(&url.URL{Path: "guest_star/invite", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.Make(g.baseUrl, "guest_star/invite", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type UpdateChannelGuestStarSettingsRequest struct {
|
type UpdateChannelGuestStarSettingsRequest struct {
|
||||||
|
@ -41,9 +39,9 @@ type UpdateChannelGuestStarSettingsRequest struct {
|
||||||
// Query parameter broadcaster_id must match the user_id in the User-Access token
|
// Query parameter broadcaster_id must match the user_id in the User-Access token
|
||||||
// Requires OAuth Scope: channel:manage:guest_star
|
// Requires OAuth Scope: channel:manage:guest_star
|
||||||
func (g *GuestStar) UpdateChannelGuestStarSettings(ctx context.Context, BroadcasterID string, body *UpdateChannelGuestStarSettingsRequest) error {
|
func (g *GuestStar) UpdateChannelGuestStarSettings(ctx context.Context, BroadcasterID string, body *UpdateChannelGuestStarSettingsRequest) error {
|
||||||
v := url.Values{"broadcaster_id": {BroadcasterID}}
|
endpoint := g.baseUrl.ResolveReference(&url.URL{Path: "guest_star/channel_settings", RawQuery: url.Values{"broadcaster_id": {BroadcasterID}}.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPut, endpoint.Make(g.baseUrl, "guest_star/channel_settings", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPut, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type UpdateGuestStarSlot struct {
|
type UpdateGuestStarSlot struct {
|
||||||
|
@ -33,8 +33,9 @@ type UpdateGuestStarSlot struct {
|
||||||
// Requires OAuth Scope: channel:manage:guest_star or moderator:manage:guest_star
|
// Requires OAuth Scope: channel:manage:guest_star or moderator:manage:guest_star
|
||||||
func (g *GuestStar) UpdateGuestStarSlot(ctx context.Context, params *UpdateGuestStarSlot) error {
|
func (g *GuestStar) UpdateGuestStarSlot(ctx context.Context, params *UpdateGuestStarSlot) error {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := g.baseUrl.ResolveReference(&url.URL{Path: "guest_star/slot", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.Make(g.baseUrl, "guest_star/slot", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type UpdateGuestStarSlotSettingsParams struct {
|
type UpdateGuestStarSlotSettingsParams struct {
|
||||||
|
@ -45,8 +45,9 @@ type UpdateGuestStarSlotSettingsParams struct {
|
||||||
// Requires OAuth Scope: channel:manage:guest_star or moderator:manage:guest_star
|
// Requires OAuth Scope: channel:manage:guest_star or moderator:manage:guest_star
|
||||||
func (g *GuestStar) UpdateGuestStarSlotSettings(ctx context.Context, params *UpdateGuestStarSlotSettingsParams) error {
|
func (g *GuestStar) UpdateGuestStarSlotSettings(ctx context.Context, params *UpdateGuestStarSlotSettingsParams) error {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := g.baseUrl.ResolveReference(&url.URL{Path: "guest_star/slot_settings", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.Make(g.baseUrl, "guest_star/slot_settings", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,10 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
"go.fifitido.net/twitch/api/types"
|
"go.fifitido.net/twitch/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -119,8 +119,9 @@ type GetHypeTrainEventsResponse struct {
|
||||||
// Requires a user access token that includes the channel:read:hype_train scope.
|
// Requires a user access token that includes the channel:read:hype_train scope.
|
||||||
func (h *Hypetrain) GetHypeTrainEvents(ctx context.Context, params *GetHypeTrainEventsParams) (*GetHypeTrainEventsResponse, error) {
|
func (h *Hypetrain) GetHypeTrainEvents(ctx context.Context, params *GetHypeTrainEventsParams) (*GetHypeTrainEventsResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := h.baseUrl.ResolveReference(&url.URL{Path: "hypetrain/events", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(h.baseUrl, "hypetrain/events", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type AddBlockedTermParams struct {
|
type AddBlockedTermParams struct {
|
||||||
|
@ -43,6 +43,7 @@ type AddBlockedTermResponse struct {
|
||||||
// Requires a user access token that includes the moderator:manage:blocked_terms scope.
|
// Requires a user access token that includes the moderator:manage:blocked_terms scope.
|
||||||
func (m *Moderation) AddBlockedTerm(ctx context.Context, params *AddBlockedTermParams, body *AddBlockedTermRequest) (*AddBlockedTermResponse, error) {
|
func (m *Moderation) AddBlockedTerm(ctx context.Context, params *AddBlockedTermParams, body *AddBlockedTermRequest) (*AddBlockedTermResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := m.baseUrl.ResolveReference(&url.URL{Path: "moderation/blocked_terms", RawQuery: v.Encode()})
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
|
|
||||||
|
@ -54,7 +55,7 @@ func (m *Moderation) AddBlockedTerm(ctx context.Context, params *AddBlockedTermP
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.Make(m.baseUrl, "moderation/blocked_terms", v), r)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.String(), r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type AddChannelModeratorParams struct {
|
type AddChannelModeratorParams struct {
|
||||||
|
@ -24,8 +24,9 @@ type AddChannelModeratorParams struct {
|
||||||
// Requires a user access token that includes the channel:manage:moderators scope.
|
// Requires a user access token that includes the channel:manage:moderators scope.
|
||||||
func (m *Moderation) AddChannelModerator(ctx context.Context, params *AddChannelModeratorParams) error {
|
func (m *Moderation) AddChannelModerator(ctx context.Context, params *AddChannelModeratorParams) error {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := m.baseUrl.ResolveReference(&url.URL{Path: "moderation/moderators", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.Make(m.baseUrl, "moderation/moderators", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type AddChannelVIPParams struct {
|
type AddChannelVIPParams struct {
|
||||||
|
@ -24,8 +24,9 @@ type AddChannelVIPParams struct {
|
||||||
// Requires a user access token that includes the channel:manage:vips scope.
|
// Requires a user access token that includes the channel:manage:vips scope.
|
||||||
func (m *Moderation) AddChannelVIP(ctx context.Context, params *AddChannelVIPParams) error {
|
func (m *Moderation) AddChannelVIP(ctx context.Context, params *AddChannelVIPParams) error {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := m.baseUrl.ResolveReference(&url.URL{Path: "channels/vips", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.Make(m.baseUrl, "channels/vips", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,10 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type BanUserParams struct {
|
type BanUserParams struct {
|
||||||
|
@ -70,6 +70,7 @@ type BanUserResponseData struct {
|
||||||
// Requires a user access token that includes the moderator:manage:banned_users scope.
|
// Requires a user access token that includes the moderator:manage:banned_users scope.
|
||||||
func (m *Moderation) BanUser(ctx context.Context, params *BanUserParams, body *BanUserRequest) (*BanUserResponse, error) {
|
func (m *Moderation) BanUser(ctx context.Context, params *BanUserParams, body *BanUserRequest) (*BanUserResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := m.baseUrl.ResolveReference(&url.URL{Path: "moderation/bans", RawQuery: v.Encode()})
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
|
|
||||||
|
@ -81,7 +82,7 @@ func (m *Moderation) BanUser(ctx context.Context, params *BanUserParams, body *B
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.Make(m.baseUrl, "moderation/bans", v), r)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.String(), r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type CheckAutoModStatusRequest struct {
|
type CheckAutoModStatusRequest struct {
|
||||||
|
@ -53,15 +51,15 @@ type CheckAutoModStatusResponseData struct {
|
||||||
// The rate limit headers in the response represent the Twitch rate limits and not the above limits.
|
// The rate limit headers in the response represent the Twitch rate limits and not the above limits.
|
||||||
//
|
//
|
||||||
// Requires a user access token that includes the moderation:read scope.
|
// Requires a user access token that includes the moderation:read scope.
|
||||||
func (m *Moderation) CheckAutoModStatus(ctx context.Context, broadcasterID string, params *CheckAutoModStatusRequest) (*CheckAutoModStatusResponse, error) {
|
func (c *Moderation) CheckAutoModStatus(ctx context.Context, broadcasterID string, params *CheckAutoModStatusRequest) (*CheckAutoModStatusResponse, error) {
|
||||||
v := url.Values{"broadcaster_id": {broadcasterID}}
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "modetation/enforcements/status", RawQuery: url.Values{"broadcaster_id": {broadcasterID}}.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.Make(m.baseUrl, "moderation/enforcements/status", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := m.client.Do(req)
|
res, err := c.client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type DeleteChatMessagesParams struct {
|
type DeleteChatMessagesParams struct {
|
||||||
|
@ -34,8 +34,9 @@ type DeleteChatMessagesParams struct {
|
||||||
// Requires a user access token that includes the moderator:manage:chat_messages scope.
|
// Requires a user access token that includes the moderator:manage:chat_messages scope.
|
||||||
func (m *Moderation) DeleteChatMessages(ctx context.Context, params *DeleteChatMessagesParams) error {
|
func (m *Moderation) DeleteChatMessages(ctx context.Context, params *DeleteChatMessagesParams) error {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := m.baseUrl.ResolveReference(&url.URL{Path: "moderation/chat", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, endpoint.Make(m.baseUrl, "moderation/chat", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetAutoModSettingsParams struct {
|
type GetAutoModSettingsParams struct {
|
||||||
|
@ -30,8 +30,9 @@ type GetAutoModSettingsResponse struct {
|
||||||
// Requires a user access token that includes the moderator:read:automod_settings scope.
|
// Requires a user access token that includes the moderator:read:automod_settings scope.
|
||||||
func (m *Moderation) GetAutoModSettings(ctx context.Context, params *GetAutoModSettingsParams) (*GetAutoModSettingsResponse, error) {
|
func (m *Moderation) GetAutoModSettings(ctx context.Context, params *GetAutoModSettingsParams) (*GetAutoModSettingsResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := m.baseUrl.ResolveReference(&url.URL{Path: "moderation/automod/settings", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(m.baseUrl, "moderation/automod/settings", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,10 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
"go.fifitido.net/twitch/api/types"
|
"go.fifitido.net/twitch/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -83,8 +83,9 @@ type GetBannedUsersResponseData struct {
|
||||||
// Requires a user access token that includes the moderation:read or moderator:manage:banned_users scope.
|
// Requires a user access token that includes the moderation:read or moderator:manage:banned_users scope.
|
||||||
func (m *Moderation) GetBannedUsers(ctx context.Context, params *GetBannedUsersParams) (*GetBannedUsersResponse, error) {
|
func (m *Moderation) GetBannedUsers(ctx context.Context, params *GetBannedUsersParams) (*GetBannedUsersResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := m.baseUrl.ResolveReference(&url.URL{Path: "moderation/banned", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(m.baseUrl, "moderation/banned", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
"go.fifitido.net/twitch/api/types"
|
"go.fifitido.net/twitch/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -44,8 +44,9 @@ type GetBlockedTermsResponse struct {
|
||||||
// Requires a user access token that includes the moderator:read:blocked_terms or moderator:manage:blocked_terms scope.
|
// Requires a user access token that includes the moderator:read:blocked_terms or moderator:manage:blocked_terms scope.
|
||||||
func (m *Moderation) GetBlockedTerms(ctx context.Context, params *GetBlockedTermsParams) (*GetBlockedTermsResponse, error) {
|
func (m *Moderation) GetBlockedTerms(ctx context.Context, params *GetBlockedTermsParams) (*GetBlockedTermsResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := m.baseUrl.ResolveReference(&url.URL{Path: "moderation/blocked_terms", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(m.baseUrl, "moderation/blocked_terms", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
"go.fifitido.net/twitch/api/types"
|
"go.fifitido.net/twitch/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -51,8 +51,9 @@ type GetModeratedChannelsResponseData struct {
|
||||||
// Requires OAuth Scope: user:read:moderated_channels
|
// Requires OAuth Scope: user:read:moderated_channels
|
||||||
func (m *Moderation) GetModeratedChannels(ctx context.Context, params *GetModeratedChannelsParams) (*GetModeratedChannelsResponse, error) {
|
func (m *Moderation) GetModeratedChannels(ctx context.Context, params *GetModeratedChannelsParams) (*GetModeratedChannelsResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := m.baseUrl.ResolveReference(&url.URL{Path: "moderation/channels", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(m.baseUrl, "moderation/channels", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
"go.fifitido.net/twitch/api/types"
|
"go.fifitido.net/twitch/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -61,8 +61,9 @@ type GetModeratorsResponseData struct {
|
||||||
// If your app also adds and removes moderators, you can use the channel:manage:moderators scope instead.
|
// If your app also adds and removes moderators, you can use the channel:manage:moderators scope instead.
|
||||||
func (m *Moderation) GetModerators(ctx context.Context, params *GetModeratorsParams) (*GetModeratorsResponse, error) {
|
func (m *Moderation) GetModerators(ctx context.Context, params *GetModeratorsParams) (*GetModeratorsResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := m.baseUrl.ResolveReference(&url.URL{Path: "moderation/moderators", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(m.baseUrl, "moderation/moderators", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetShieldModeStatusParams struct {
|
type GetShieldModeStatusParams struct {
|
||||||
|
@ -31,8 +31,9 @@ type GetShieldModeStatusResponse struct {
|
||||||
// Requires a user access token that includes the moderator:read:shield_mode or moderator:manage:shield_mode scope.
|
// Requires a user access token that includes the moderator:read:shield_mode or moderator:manage:shield_mode scope.
|
||||||
func (m *Moderation) GetShieldModeStatus(ctx context.Context, params *GetShieldModeStatusParams) (*GetShieldModeStatusResponse, error) {
|
func (m *Moderation) GetShieldModeStatus(ctx context.Context, params *GetShieldModeStatusParams) (*GetShieldModeStatusResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := m.baseUrl.ResolveReference(&url.URL{Path: "moderation/shield_mode", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(m.baseUrl, "moderation/shield_mode", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
"go.fifitido.net/twitch/api/types"
|
"go.fifitido.net/twitch/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -59,8 +59,9 @@ type GetVIPsResponseData struct {
|
||||||
// If your app also adds and removes VIP status, you can use the channel:manage:vips scope instead.
|
// If your app also adds and removes VIP status, you can use the channel:manage:vips scope instead.
|
||||||
func (m *Moderation) GetVIPs(ctx context.Context, params GetVIPsParams) (*GetVIPsResponse, error) {
|
func (m *Moderation) GetVIPs(ctx context.Context, params GetVIPsParams) (*GetVIPsResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := m.baseUrl.ResolveReference(&url.URL{Path: "moderation/vips", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(m.baseUrl, "moderation/vips", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type AutoModAction string
|
type AutoModAction string
|
||||||
|
@ -34,8 +33,9 @@ type ManageHeldAutoModMessagesRequest struct {
|
||||||
//
|
//
|
||||||
// Requires a user access token that includes the moderator:manage:automod scope.
|
// Requires a user access token that includes the moderator:manage:automod scope.
|
||||||
func (m *Moderation) ManageHeldAutoModMessages(ctx context.Context, body *ManageHeldAutoModMessagesRequest) error {
|
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.Make(m.baseUrl, "moderation/automod/message"), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type RemoveBlockedTermParams struct {
|
type RemoveBlockedTermParams struct {
|
||||||
|
@ -26,8 +26,9 @@ type RemoveBlockedTermParams struct {
|
||||||
// Requires a user access token that includes the moderator:manage:blocked_terms scope.
|
// Requires a user access token that includes the moderator:manage:blocked_terms scope.
|
||||||
func (m *Moderation) RemoveBlockedTerm(ctx context.Context, params *RemoveBlockedTermParams) error {
|
func (m *Moderation) RemoveBlockedTerm(ctx context.Context, params *RemoveBlockedTermParams) error {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := m.baseUrl.ResolveReference(&url.URL{Path: "moderation/blocks", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, endpoint.Make(m.baseUrl, "moderation/blocks", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type RemoveChannelModeratorParams struct {
|
type RemoveChannelModeratorParams struct {
|
||||||
|
@ -24,8 +24,9 @@ type RemoveChannelModeratorParams struct {
|
||||||
// Requires a user access token that includes the channel:manage:moderators scope.
|
// Requires a user access token that includes the channel:manage:moderators scope.
|
||||||
func (m *Moderation) RemoveChannelModerator(ctx context.Context, params *RemoveChannelModeratorParams) error {
|
func (m *Moderation) RemoveChannelModerator(ctx context.Context, params *RemoveChannelModeratorParams) error {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := m.baseUrl.ResolveReference(&url.URL{Path: "moderation/moderators", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, endpoint.Make(m.baseUrl, "moderation/moderators", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type RemoveChannelVIPParams struct {
|
type RemoveChannelVIPParams struct {
|
||||||
|
@ -27,8 +27,9 @@ type RemoveChannelVIPParams struct {
|
||||||
// Requires a user access token that includes the channel:manage:vips scope.
|
// Requires a user access token that includes the channel:manage:vips scope.
|
||||||
func (m *Moderation) RemoveChannelVIP(ctx context.Context, params *RemoveChannelVIPParams) error {
|
func (m *Moderation) RemoveChannelVIP(ctx context.Context, params *RemoveChannelVIPParams) error {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := m.baseUrl.ResolveReference(&url.URL{Path: "channels/vips", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, endpoint.Make(m.baseUrl, "channels/vips", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type UnbanUserParams struct {
|
type UnbanUserParams struct {
|
||||||
|
@ -28,8 +28,9 @@ type UnbanUserParams struct {
|
||||||
// Requires a user access token that includes the moderator:manage:banned_users scope.
|
// Requires a user access token that includes the moderator:manage:banned_users scope.
|
||||||
func (m *Moderation) UnbanUser(ctx context.Context, params *UnbanUserParams) error {
|
func (m *Moderation) UnbanUser(ctx context.Context, params *UnbanUserParams) error {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := m.baseUrl.ResolveReference(&url.URL{Path: "moderation/bans", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, endpoint.Make(m.baseUrl, "moderation/bans", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type UpdateAutoModSettingsParams struct {
|
type UpdateAutoModSettingsParams struct {
|
||||||
|
@ -79,6 +79,7 @@ type UpdateAutoModSettingsResponse struct {
|
||||||
// Requires a user access token that includes the moderator:manage:automod_settings scope.
|
// Requires a user access token that includes the moderator:manage:automod_settings scope.
|
||||||
func (m *Moderation) UpdateAutoModSettings(ctx context.Context, params *UpdateAutoModSettingsParams, body *UpdateAutoModSettingsRequest) (*UpdateAutoModSettingsResponse, error) {
|
func (m *Moderation) UpdateAutoModSettings(ctx context.Context, params *UpdateAutoModSettingsParams, body *UpdateAutoModSettingsRequest) (*UpdateAutoModSettingsResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := m.baseUrl.ResolveReference(&url.URL{Path: "moderation/automod/settings", RawQuery: v.Encode()})
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
|
|
||||||
|
@ -90,7 +91,7 @@ func (m *Moderation) UpdateAutoModSettings(ctx context.Context, params *UpdateAu
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPut, endpoint.Make(m.baseUrl, "moderation/automod/settings", v), r)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPut, endpoint.String(), r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type UpdateShieldModeStatusParams struct {
|
type UpdateShieldModeStatusParams struct {
|
||||||
|
@ -38,6 +38,7 @@ type UpdateShieldModeStatusResponse struct {
|
||||||
// Requires a user access token that includes the moderator:manage:shield_mode scope.
|
// Requires a user access token that includes the moderator:manage:shield_mode scope.
|
||||||
func (m *Moderation) UpdateShieldModeStatus(ctx context.Context, params *UpdateShieldModeStatusParams) (*UpdateShieldModeStatusResponse, error) {
|
func (m *Moderation) UpdateShieldModeStatus(ctx context.Context, params *UpdateShieldModeStatusParams) (*UpdateShieldModeStatusResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := m.baseUrl.ResolveReference(&url.URL{Path: "moderation/shield_mode", RawQuery: v.Encode()})
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
|
|
||||||
|
@ -49,7 +50,7 @@ func (m *Moderation) UpdateShieldModeStatus(ctx context.Context, params *UpdateS
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPatch, endpoint.Make(m.baseUrl, "moderation/shield_mode", v), r)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPatch, endpoint.String(), r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type CreatePollRequest struct {
|
type CreatePollRequest struct {
|
||||||
|
@ -50,6 +49,8 @@ type CreatePollResponse struct {
|
||||||
//
|
//
|
||||||
// Requires a user access token that includes the channel:manage:polls scope.
|
// Requires a user access token that includes the channel:manage:polls scope.
|
||||||
func (p *Polls) CreatePoll(ctx context.Context, body *CreatePollRequest) (*CreatePollResponse, error) {
|
func (p *Polls) CreatePoll(ctx context.Context, body *CreatePollRequest) (*CreatePollResponse, error) {
|
||||||
|
endpoint := p.baseUrl.ResolveReference(&url.URL{Path: "polls"})
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
@ -60,7 +61,7 @@ func (p *Polls) CreatePoll(ctx context.Context, body *CreatePollRequest) (*Creat
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.Make(p.baseUrl, "polls"), r)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.String(), r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type EndPollParams struct {
|
type EndPollParams struct {
|
||||||
|
@ -30,8 +30,9 @@ type EndPollParams struct {
|
||||||
// Requires a user access token that includes the channel:manage:polls scope.
|
// Requires a user access token that includes the channel:manage:polls scope.
|
||||||
func (p *Polls) EndPoll(ctx context.Context, params *EndPollParams) error {
|
func (p *Polls) EndPoll(ctx context.Context, params *EndPollParams) error {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := p.baseUrl.ResolveReference(&url.URL{Path: "polls", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodPatch, endpoint.Make(p.baseUrl, "polls", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodPatch, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.fifitido.net/twitch/api/endpoint"
|
|
||||||
"go.fifitido.net/twitch/api/types"
|
"go.fifitido.net/twitch/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -50,8 +50,9 @@ type GetPollsResponse struct {
|
||||||
// Requires a user access token that includes the channel:read:polls or channel:manage:polls scope.
|
// Requires a user access token that includes the channel:read:polls or channel:manage:polls scope.
|
||||||
func (p *Polls) GetPolls(ctx context.Context, params *GetPollsParams) (*GetPollsResponse, error) {
|
func (p *Polls) GetPolls(ctx context.Context, params *GetPollsParams) (*GetPollsResponse, error) {
|
||||||
v, _ := query.Values(params)
|
v, _ := query.Values(params)
|
||||||
|
endpoint := p.baseUrl.ResolveReference(&url.URL{Path: "polls", RawQuery: v.Encode()})
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(p.baseUrl, "polls", v), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue