hackathon/api/v1/auth.gunk

52 lines
1.0 KiB
Go

2021-12-19 15:30:21 +07:00
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",
// }
2022-04-28 23:31:09 +07:00
DeleteToken(DeleteTokenRequest) DeleteTokenResponse
2021-12-19 15:30:21 +07:00
}
type Token struct {
2022-04-28 23:31:09 +07:00
Token string `pb:"1" json:"token"`
Expires string `pb:"2" json:"expires"`
2021-12-19 15:30:21 +07:00
}
type OAuthCodeRequest struct{}
type OAuthCodeResponse struct {
2022-04-28 23:31:09 +07:00
RedirectURI string `pb:"1" json:"redirectURI"`
2021-12-19 15:30:21 +07:00
}
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"`
}
2022-04-28 23:31:09 +07:00
type DeleteTokenResponse struct{}