diff --git a/client.go b/client.go index 0333930..9e9f6ea 100644 --- a/client.go +++ b/client.go @@ -286,9 +286,13 @@ func (c *Client) GetEnrichedActivitiesByID(ctx context.Context, ids []string, op } // GetReactions returns reactions for the current app having the given IDs. -func (c *Client) GetReactions(ctx context.Context, ids []string) (*GetReactionsByIDsResponse, error) { +func (c *Client) GetReactions(ctx context.Context, ids []string, opts ...GetReactionsOption) (*GetReactionsByIDsResponse, error) { endpoint := c.makeEndpoint("reaction/get_many/") endpoint.addQueryParam(makeRequestOption("ids", strings.Join(ids, ","))) + + for _, opt := range opts { + endpoint.addQueryParam(opt) + } data, err := c.get(ctx, endpoint, nil, c.authenticator.reactionsAuth) if err != nil { return nil, err diff --git a/client_test.go b/client_test.go index 3d1067e..1b8695b 100644 --- a/client_test.go +++ b/client_test.go @@ -155,6 +155,14 @@ func TestGetReactions(t *testing.T) { testRequest(t, requester.req, http.MethodGet, "https://api.stream-io-api.com/api/v1.0/reaction/get_many/?api_key=key&ids=foo%2Cbar%2Cbaz", "") } +func TestGetReactionsIncludeDeleted(t *testing.T) { + ctx := context.Background() + client, requester := newClient(t) + _, err := client.GetReactions(ctx, []string{"foo", "bar", "baz"}, stream.WithReactionsIncludeDeleted()) + require.NoError(t, err) + testRequest(t, requester.req, http.MethodGet, "https://api.stream-io-api.com/api/v1.0/reaction/get_many/?api_key=key&ids=foo%2Cbar%2Cbaz&include_deleted=true", "") +} + func TestUpdateActivityByID(t *testing.T) { ctx := context.Background() client, requester := newClient(t) diff --git a/options.go b/options.go index a7af626..5dc4832 100644 --- a/options.go +++ b/options.go @@ -414,3 +414,11 @@ func (nop) values() (key, value string) { func (nop) valid() bool { return false } + +type GetReactionsOption struct { + requestOption +} + +func WithReactionsIncludeDeleted() GetReactionsOption { + return GetReactionsOption{makeRequestOption("include_deleted", true)} +}