From 0456a9099e2f525ddbcd687622b3bbedd63fe894 Mon Sep 17 00:00:00 2001 From: ajatprabha Date: Mon, 4 Dec 2023 23:49:22 +0530 Subject: [PATCH] rename handler --- docs/docs/sdk/SDK.md | 20 ++++++++++---------- http.go | 4 ++-- http_test.go | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/docs/sdk/SDK.md b/docs/docs/sdk/SDK.md index a22fcf3..6a2e24f 100644 --- a/docs/docs/sdk/SDK.md +++ b/docs/docs/sdk/SDK.md @@ -16,6 +16,7 @@ Package courier contains the client that can be used to interact with the courie - [func WaitForConnection\(c ConnectionInformer, waitFor time.Duration, tick time.Duration\) bool](#WaitForConnection) - [type Client](#Client) - [func NewClient\(opts ...ClientOption\) \(\*Client, error\)](#NewClient) + - [func \(c \*Client\) InfoHandler\(\) http.Handler](#Client.InfoHandler) - [func \(c \*Client\) IsConnected\(\) bool](#Client.IsConnected) - [func \(c \*Client\) Publish\(ctx context.Context, topic string, message interface\{\}, opts ...Option\) error](#Client.Publish) - [func \(c \*Client\) Run\(ctx context.Context\) error](#Client.Run) @@ -23,7 +24,6 @@ Package courier contains the client that can be used to interact with the courie - [func \(c \*Client\) Stop\(\)](#Client.Stop) - [func \(c \*Client\) Subscribe\(ctx context.Context, topic string, callback MessageHandler, opts ...Option\) error](#Client.Subscribe) - [func \(c \*Client\) SubscribeMultiple\(ctx context.Context, topicsWithQos map\[string\]QOSLevel, callback MessageHandler\) error](#Client.SubscribeMultiple) - - [func \(c \*Client\) TelemetryHandler\(\) http.Handler](#Client.TelemetryHandler) - [func \(c \*Client\) Unsubscribe\(ctx context.Context, topics ...string\) error](#Client.Unsubscribe) - [func \(c \*Client\) UsePublisherMiddleware\(mwf ...PublisherMiddlewareFunc\)](#Client.UsePublisherMiddleware) - [func \(c \*Client\) UseSubscriberMiddleware\(mwf ...SubscriberMiddlewareFunc\)](#Client.UseSubscriberMiddleware) @@ -237,6 +237,15 @@ c.Stop()

+ +### func \(\*Client\) [InfoHandler](https://github.com/gojek/courier-go/blob/main/http.go#L9) + +```go +func (c *Client) InfoHandler() http.Handler +``` + +InfoHandler returns a http.Handler that exposes the connected clients information + ### func \(\*Client\) [IsConnected](https://github.com/gojek/courier-go/blob/main/client.go#L84) @@ -300,15 +309,6 @@ func (c *Client) SubscribeMultiple(ctx context.Context, topicsWithQos map[string SubscribeMultiple allows to subscribe to messages on multiple topics from an MQTT broker - -### func \(\*Client\) [TelemetryHandler](https://github.com/gojek/courier-go/blob/main/http.go#L9) - -```go -func (c *Client) TelemetryHandler() http.Handler -``` - -TelemetryHandler returns a http.Handler that exposes the connected clients information - ### func \(\*Client\) [Unsubscribe](https://github.com/gojek/courier-go/blob/main/client_unsubscribe.go#L10) diff --git a/http.go b/http.go index e4ad159..0dd588c 100644 --- a/http.go +++ b/http.go @@ -5,8 +5,8 @@ import ( "net/http" ) -// TelemetryHandler returns a http.Handler that exposes the connected clients information -func (c *Client) TelemetryHandler() http.Handler { +// InfoHandler returns a http.Handler that exposes the connected clients information +func (c *Client) InfoHandler() http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { cl := c.allClientInfo() diff --git a/http_test.go b/http_test.go index eb13ba5..f852c0d 100644 --- a/http_test.go +++ b/http_test.go @@ -69,7 +69,7 @@ func TestClient_TelemetryHandler(t *testing.T) { _ = c.Run(ctx) }() - h := c.TelemetryHandler() + h := c.InfoHandler() assert.True(t, WaitForConnection(c, 2*time.Second, 100*time.Millisecond))