From c3a19f4c98a2b3c71ae6b1f9c0d2f3887351b314 Mon Sep 17 00:00:00 2001 From: Scorfly Date: Wed, 8 May 2024 21:36:12 +0200 Subject: [PATCH] Set users IDs as array to get ban users list --- moderation.go | 7 ++++--- moderation_test.go | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/moderation.go b/moderation.go index c1cb95a..e69c1dd 100644 --- a/moderation.go +++ b/moderation.go @@ -23,9 +23,10 @@ type BannedUsersResponse struct { // BroadcasterID must match the auth tokens user_id type BannedUsersParams struct { BroadcasterID string `query:"broadcaster_id"` - UserID string `query:"user_id"` - After string `query:"after"` - Before string `query:"before"` + // Filter by provided UserIDs + UserID []string `query:"user_id"` + After string `query:"after"` + Before string `query:"before"` } // GetBannedUsers returns all banned and timed-out users in a channel. diff --git a/moderation_test.go b/moderation_test.go index 3168f3b..91d2dbe 100644 --- a/moderation_test.go +++ b/moderation_test.go @@ -14,7 +14,7 @@ func TestGetBannedUsers(t *testing.T) { statusCode int options *Options BroadcasterID string - UserID string + UserID []string After string Before string respBody string @@ -23,7 +23,7 @@ func TestGetBannedUsers(t *testing.T) { http.StatusBadRequest, &Options{ClientID: "my-client-id"}, "", // missing broadcaster id - "", + []string{}, "", "", `{"error":"Bad Request","status":400,"message":"Missing required parameter \"broadcaster_id\""}`, @@ -32,7 +32,7 @@ func TestGetBannedUsers(t *testing.T) { http.StatusOK, &Options{ClientID: "my-client-id"}, "23161357", - "", + []string{}, "", "", `{"data":[{"expires_at":"","user_id":"54946241","user_name":"chronophylos","user_name":"chronophylos"},{"expires_at":"2022-03-15T02:00:28Z","user_id":"423374343","user_name":"glowillig"}],"pagination":{"cursor":"eyJiIjpudWxsLCJhIjp7Ik9mZnNldCI6MX19"}}`,