From d54f088550322811b35b7eb0e5d953fd1ef4a955 Mon Sep 17 00:00:00 2001 From: some Date: Wed, 9 Oct 2024 13:25:54 -0400 Subject: [PATCH] Allow chaining of Register functions --- router.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/router.go b/router.go index 1a3fb08..7942ddb 100644 --- a/router.go +++ b/router.go @@ -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 }