Skip to content

Commit 912341e

Browse files
committed
Rename groupIDS to groupIDs
1 parent 8c5884e commit 912341e

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

group/group.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,23 +152,23 @@ func validateUpdate(request *Request) error {
152152
}
153153

154154
// AddContacts adds a maximum of 50 contacts to the group.
155-
func AddContacts(c *messagebird.Client, groupID string, contactIDS []string) error {
156-
if err := validateAddContacts(contactIDS); err != nil {
155+
func AddContacts(c *messagebird.Client, groupID string, contactIDs []string) error {
156+
if err := validateAddContacts(contactIDs); err != nil {
157157
return err
158158
}
159159

160-
query := addContactsQuery(contactIDS)
160+
query := addContactsQuery(contactIDs)
161161
formattedPath := fmt.Sprintf("%s/%s/%s?%s", path, groupID, contactPath, query)
162162

163163
return c.Request(nil, http.MethodGet, formattedPath, nil)
164164
}
165165

166-
func validateAddContacts(contactIDS []string) error {
167-
count := len(contactIDS)
166+
func validateAddContacts(contactIDs []string) error {
167+
count := len(contactIDs)
168168

169169
// len(nil) == 0: https://golang.org/ref/spec#Length_and_capacity
170170
if count == 0 {
171-
return fmt.Errorf("contactIDS is required")
171+
return fmt.Errorf("contactIDs is required")
172172
}
173173

174174
if count > 50 {
@@ -183,12 +183,12 @@ func validateAddContacts(contactIDS []string) error {
183183
// as GET params. Sending these in the request body would require a painful
184184
// workaround, as client.Request sends request bodies as JSON by default. See
185185
// also: https://developers.messagebird.com/docs/alternatives.
186-
func addContactsQuery(contactIDS []string) string {
186+
func addContactsQuery(contactIDs []string) string {
187187
// Slice's length is one bigger than len(IDs) for the _method param.
188-
params := make([]string, 0, len(contactIDS)+1)
188+
params := make([]string, 0, len(contactIDs)+1)
189189
params = append(params, "_method="+http.MethodPut)
190190

191-
for _, contactID := range contactIDS {
191+
for _, contactID := range contactIDs {
192192
params = append(params, "ids[]="+contactID)
193193
}
194194

group/group_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,14 @@ func TestAddContactsWithEmptyContacts(t *testing.T) {
180180
client := mbtest.Client(t)
181181

182182
tt := []struct {
183-
contactIDS []string
183+
contactIDs []string
184184
}{
185185
{[]string{}},
186186
{nil},
187187
}
188188

189189
for _, tc := range tt {
190-
if err := AddContacts(client, "group-id", tc.contactIDS); err == nil {
190+
if err := AddContacts(client, "group-id", tc.contactIDs); err == nil {
191191
t.Fatalf("expected error, got nil")
192192
}
193193
}
@@ -197,9 +197,9 @@ func TestAddContactsWithTooManyContacts(t *testing.T) {
197197
client := mbtest.Client(t)
198198

199199
// Only 50 contacts are allowed at a time.
200-
contactIDS := make([]string, 51)
200+
contactIDs := make([]string, 51)
201201

202-
if err := AddContacts(client, "group-id", contactIDS); err == nil {
202+
if err := AddContacts(client, "group-id", contactIDs); err == nil {
203203
t.Fatalf("expected error, got nil")
204204
}
205205
}

0 commit comments

Comments
 (0)