Skip to content

Commit ac7da2c

Browse files
committed
Extract maximum number of contacts per request to const
1 parent 2969fba commit ac7da2c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

group/group.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ const (
5959
contactPath = "contacts"
6060
)
6161

62+
// maximumContactsPerRequest is the maxium number of contacts that can be
63+
// created in a single request.
64+
const maximumContactsPerRequest = 50
65+
6266
// DefaultListOptions provides reasonable values for List().
6367
var DefaultListOptions = &ListOptions{
6468
Limit: 10,
@@ -171,8 +175,8 @@ func validateAddContacts(contactIDs []string) error {
171175
return fmt.Errorf("at least one contactID is required")
172176
}
173177

174-
if count > 50 {
175-
return fmt.Errorf("can not add more than 50 contacts per request, got %d", count)
178+
if count > maximumContactsPerRequest {
179+
return fmt.Errorf("can not add more than %d contacts per request, got %d", maximumContactsPerRequest, count)
176180
}
177181

178182
return nil

0 commit comments

Comments
 (0)