40 lines
845 B
Go
40 lines
845 B
Go
package ttv
|
|
|
|
import (
|
|
"zomo.dev/largehadroncollider/db"
|
|
"zomo.dev/largehadroncollider/util"
|
|
)
|
|
|
|
func InitTwitchConn(conf *util.Config, dbConn *db.DBConn) (*TwitchConn, error) {
|
|
auth, err := initAuth(conf, dbConn)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &TwitchConn{auth}, nil
|
|
}
|
|
|
|
type TwitchConn struct {
|
|
Auth *TwitchAuth
|
|
}
|
|
|
|
type TwitchAuthRespOk struct {
|
|
Code string `json:"code"`
|
|
Scope string `json:"scope"`
|
|
State string `json:"state"`
|
|
}
|
|
|
|
type TwitchAuthRespErr struct {
|
|
Err string `json:"error"`
|
|
ErrDesc string `json:"error_description"`
|
|
State string `json:"state"`
|
|
}
|
|
|
|
type TwitchAuthTokenResp struct {
|
|
AccessToken string `json:"access_token"`
|
|
ExpiresIn int `json:"expires_in"`
|
|
RefreshToken string `json:"refresh_token"`
|
|
Scope []string `json:"scope"`
|
|
TokenType string `json:"token_type"`
|
|
}
|