Allow chaining of Register functions

This commit is contained in:
some 2024-10-09 13:25:54 -04:00
parent 756881cf14
commit d54f088550
Signed by: some
GPG Key ID: 65D0589220B9BFC8

View File

@ -46,10 +46,12 @@ func NewRouter(r *router.Router, logger log.Logger, endpointOverride ...Endpoint
}
}
func (ro *Router) RegisterCallbackServer(srv server.CallbackServer) {
func (ro *Router) RegisterCallbackServer(srv server.CallbackServer) *Router {
ro.Register(ro.CallbackEndpoint, router.NewServer(srv.Callback).SetLogger(ro.Logger))
return ro
}
func (ro *Router) RegisterTokenServer(srv server.TokenServer) {
func (ro *Router) RegisterTokenServer(srv server.TokenServer) *Router {
ro.Register(ro.TokenEndpoint, router.NewServer(srv.Token).SetLogger(ro.Logger))
return ro
}