moved auth structs
This commit is contained in:
20
ttv/auth.go
20
ttv/auth.go
@@ -32,6 +32,26 @@ type TwitchAuth struct {
|
|||||||
Client *api.Client
|
Client *api.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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"`
|
||||||
|
}
|
||||||
|
|
||||||
func (twitch *TwitchAuth) doAuth(formData url.Values) (TwitchAuthTokenResp, error) {
|
func (twitch *TwitchAuth) doAuth(formData url.Values) (TwitchAuthTokenResp, error) {
|
||||||
resp, err := http.PostForm(TWITCH_AUTH_URL, formData)
|
resp, err := http.PostForm(TWITCH_AUTH_URL, formData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
20
ttv/main.go
20
ttv/main.go
@@ -17,23 +17,3 @@ func InitTwitchConn(conf *util.Config, dbConn *db.DBConn) (*TwitchConn, error) {
|
|||||||
type TwitchConn struct {
|
type TwitchConn struct {
|
||||||
Auth *TwitchAuth
|
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"`
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user