hackathon/api/v1/auth.gunk

52 lines
1.0 KiB
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) DeleteTokenResponse
}
type Token struct {
Token string `pb:"1" json:"token"`
Expires string `pb:"2" json:"expires"`
}
type OAuthCodeRequest struct{}
type OAuthCodeResponse struct {
RedirectURI string `pb:"1" json:"redirectURI"`
}
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"`
}
type DeleteTokenResponse struct{}