package server import ( "encoding/json" "somehole.com/service/oauth2/session" "somehole.com/service/router" ) type CallbackRequestBuilder struct { router.UnimplementedRequestBuilder values struct { router.Values State session.State `form:"state"` Code session.Code `form:"code"` } } func (rb CallbackRequestBuilder) RequestBuilder() router.RequestBuilder { return &rb } func (rb *CallbackRequestBuilder) Values(values router.Values) (errRes router.ErrorResponse) { err := rb.values.Values.Parse(values) if err != nil { return ErrorBadRequest } return Ok } type CallbackResponse struct { router.UnimplementedResponse Body struct { Message string `json:"message"` } } func (r *CallbackResponse) BodyBytes() (body []byte) { body, _ = json.Marshal(r.Body) return } type UnimplementedCallbackServer struct{} func (UnimplementedCallbackServer) mustEmbedUnimplementedCallbackServer() {} func (UnimplementedCallbackServer) Callback(req *CallbackRequestBuilder) (res *CallbackResponse, errRes router.ErrorResponse) { errRes = ErrorNotImplemented return } type CallbackServer interface { mustEmbedUnimplementedCallbackServer() Callback(req *CallbackRequestBuilder) (res *CallbackResponse, errRes router.ErrorResponse) }