Documentation
¶
Index ¶
- Constants
- func HelixAllowlistMiddleware(next http.Handler) http.Handler
- type API
- type CheckLinkResponse
- type Client
- func (c *Client) CheckLink(ctx context.Context, targetURL string) (CheckLinkResponse, error)
- func (c *Client) GetChannelChatBadges(ctx context.Context, broadcasterID string) ([]twitchapi.BadgeSet, error)
- func (c *Client) GetChannelEmotes(ctx context.Context, broadcaster string) (twitchapi.EmoteResponse, error)
- func (c *Client) GetChatSettings(ctx context.Context, broadcasterID string, moderatorID string) (twitchapi.GetChatSettingsResponse, error)
- func (c *Client) GetGlobalChatBadges(ctx context.Context) ([]twitchapi.BadgeSet, error)
- func (c *Client) GetGlobalEmotes(ctx context.Context) (twitchapi.EmoteResponse, error)
- func (c *Client) GetStreamInfo(ctx context.Context, broadcastID []string) (twitchapi.GetStreamsResponse, error)
- func (c *Client) GetUsers(ctx context.Context, logins []string, ids []string) (twitchapi.UserResponse, error)
- func (c *Client) RefreshToken(ctx context.Context, refreshToken string) (string, string, error)
- func (c *Client) RevokeToken(ctx context.Context, token string) error
- type Config
- type HelixTokenProvider
- type RateLimiter
- type RedisConfig
Constants ¶
const DefaultHelixBaseURL = "https://api.twitch.tv"
DefaultHelixBaseURL is the default Twitch Helix API base URL.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CheckLinkResponse ¶ added in v0.7.0
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetChannelChatBadges ¶ added in v0.6.2
func (*Client) GetChannelEmotes ¶
func (*Client) GetChatSettings ¶
func (*Client) GetGlobalChatBadges ¶ added in v0.6.2
func (*Client) GetGlobalEmotes ¶
func (*Client) GetStreamInfo ¶
func (*Client) RefreshToken ¶
type HelixTokenProvider ¶ added in v0.7.0
type HelixTokenProvider struct {
// contains filtered or unexported fields
}
HelixTokenProvider manages app access tokens for the Twitch Helix API. It handles token creation and caching using the client credentials flow.
func NewHelixTokenProvider ¶ added in v0.7.0
func NewHelixTokenProvider(client *http.Client, clientID, clientSecret string) *HelixTokenProvider
NewHelixTokenProvider creates a new Helix token provider.
func (*HelixTokenProvider) EnsureToken ¶ added in v0.7.0
func (p *HelixTokenProvider) EnsureToken(ctx context.Context) (string, error)
EnsureToken returns a valid app access token, creating one if necessary. This method may perform HTTP requests to fetch a new token.
func (*HelixTokenProvider) InvalidateToken ¶ added in v0.7.0
func (p *HelixTokenProvider) InvalidateToken()
InvalidateToken clears the cached token, forcing a refresh on next GetToken call.
type RateLimiter ¶ added in v0.7.0
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter implements sliding window rate limiting using Redis
func NewRateLimiter ¶ added in v0.7.0
func NewRateLimiter(client *redis.Client, logger zerolog.Logger) *RateLimiter
NewRateLimiter creates a new rate limiter with Redis client. If client is nil, rate limiting is disabled.
func (*RateLimiter) Middleware ¶ added in v0.7.0
func (rl *RateLimiter) Middleware(next http.Handler) http.Handler
Middleware returns a middleware that enforces rate limits per client IP
type RedisConfig ¶ added in v0.7.0
RedisConfig holds Redis connection configuration