50 lines
978 B
Go
50 lines
978 B
Go
|
package codequest
|
||
|
|
||
|
import (
|
||
|
"github.com/gunk/opt/http"
|
||
|
"github.com/gunk/opt/openapiv2"
|
||
|
"github.com/gunk/opt/proto"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
type AuthService interface {
|
||
|
// +gunk http.Match{
|
||
|
// Method: "GET",
|
||
|
// Path: "/v1/auth/code",
|
||
|
// }
|
||
|
OAuthCode(OAuthCodeRequest) OAuthCodeResponse
|
||
|
|
||
|
// +gunk http.Match{
|
||
|
// Method: "GET",
|
||
|
// Path: "/v1/auth/token",
|
||
|
// }
|
||
|
Token(TokenRequest) Token
|
||
|
|
||
|
// +gunk http.Match{
|
||
|
// Method: "DELETE",
|
||
|
// Path: "/v1/auth/token",
|
||
|
// }
|
||
|
DeleteToken(DeleteTokenRequest)
|
||
|
}
|
||
|
|
||
|
type Token struct {
|
||
|
Token string `pb:"1" json:"token"`
|
||
|
Expires time.Time `pb:"2" json:"expires"`
|
||
|
}
|
||
|
|
||
|
type OAuthCodeRequest struct{}
|
||
|
|
||
|
type OAuthCodeResponse struct {
|
||
|
RedirectURI string `pb:"1" json:"redirect_uri"`
|
||
|
}
|
||
|
|
||
|
type TokenRequest struct {
|
||
|
Code string `pb:"1" json:"code"`
|
||
|
State string `pb:"2" json:"state"`
|
||
|
}
|
||
|
|
||
|
type DeleteTokenRequest struct {
|
||
|
All bool `pb:"1" json:"all"`
|
||
|
Token Token `pb:"2" json:"token"`
|
||
|
}
|