66 lines
1.8 KiB
Go
66 lines
1.8 KiB
Go
package api
|
|
|
|
import (
|
|
"net/http"
|
|
"net/url"
|
|
|
|
"go.fifitido.net/twitch/api/ads"
|
|
"go.fifitido.net/twitch/api/analytics"
|
|
"go.fifitido.net/twitch/api/bits"
|
|
"go.fifitido.net/twitch/api/ccls"
|
|
"go.fifitido.net/twitch/api/channelpoints"
|
|
"go.fifitido.net/twitch/api/channels"
|
|
"go.fifitido.net/twitch/api/charity"
|
|
"go.fifitido.net/twitch/api/chat"
|
|
"go.fifitido.net/twitch/api/conduit"
|
|
"go.fifitido.net/twitch/api/entitlements"
|
|
"go.fifitido.net/twitch/api/eventsub"
|
|
"go.fifitido.net/twitch/api/extensions"
|
|
"go.fifitido.net/twitch/api/games"
|
|
)
|
|
|
|
const HelixBaseUrl = "https://api.twitch.tv/helix"
|
|
|
|
type API struct {
|
|
client *http.Client
|
|
baseUrl *url.URL
|
|
|
|
Ads *ads.Ads
|
|
Analytics *analytics.Analytics
|
|
Bits *bits.Bits
|
|
Channels *channels.Channels
|
|
ChannelPoints *channelpoints.ChannelPoints
|
|
Charity *charity.Charity
|
|
Chat *chat.Chat
|
|
Conduit *conduit.Conduit
|
|
CCLS *ccls.CCLS
|
|
Entitlements *entitlements.Entitlements
|
|
Extensions *extensions.Extensions
|
|
EventSub *eventsub.EventSub
|
|
Games *games.Games
|
|
}
|
|
|
|
func New() *API {
|
|
client := &http.Client{}
|
|
baseUrl, _ := url.Parse(HelixBaseUrl)
|
|
|
|
return &API{
|
|
client: client,
|
|
baseUrl: baseUrl,
|
|
|
|
Ads: ads.New(client, baseUrl),
|
|
Analytics: analytics.New(client, baseUrl),
|
|
Bits: bits.New(client, baseUrl),
|
|
Channels: channels.New(client, baseUrl),
|
|
ChannelPoints: channelpoints.New(client, baseUrl),
|
|
Charity: charity.New(client, baseUrl),
|
|
Chat: chat.New(client, baseUrl),
|
|
Conduit: conduit.New(client, baseUrl),
|
|
CCLS: ccls.New(client, baseUrl),
|
|
Entitlements: entitlements.New(client, baseUrl),
|
|
Extensions: extensions.New(client, baseUrl),
|
|
EventSub: eventsub.New(client, baseUrl),
|
|
Games: games.New(client, baseUrl),
|
|
}
|
|
}
|