From 3e2bdc63c758aac3a4e407ee8b08b93bd2a8c5bb Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Fri, 26 Apr 2019 20:53:58 -0500 Subject: [PATCH] Add streaming list support. --- streaming.go | 8 ++++++++ streaming_ws.go | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/streaming.go b/streaming.go index b3242a4..2e389a1 100644 --- a/streaming.go +++ b/streaming.go @@ -156,3 +156,11 @@ func (c *Client) StreamingHashtag(ctx context.Context, tag string, isLocal bool) return c.streaming(ctx, p, params) } + +// StreamingList return channel to read events on a list. +func (c *Client) StreamingList(ctx context.Context, id ID) (chan Event, error) { + params := url.Values{} + params.Set("list", string(id)) + + return c.streaming(ctx, "list", params) +} diff --git a/streaming_ws.go b/streaming_ws.go index d37fcfe..3d8927c 100644 --- a/streaming_ws.go +++ b/streaming_ws.go @@ -51,6 +51,11 @@ func (c *WSClient) StreamingWSHashtag(ctx context.Context, tag string, isLocal b return c.streamingWS(ctx, s, tag) } +// StreamingWSList return channel to read events on a list using WebSocket. +func (c *WSClient) StreamingWSList(ctx context.Context, id ID) (chan Event, error) { + return c.streamingWS(ctx, "list", string(id)) +} + func (c *WSClient) streamingWS(ctx context.Context, stream, tag string) (chan Event, error) { params := url.Values{} params.Set("access_token", c.client.config.AccessToken)