@@ -72,9 +72,7 @@ func Create(c *messagebird.Client, request *Request) (*Group, error) {
72
72
}
73
73
74
74
group := & Group {}
75
-
76
- err := c .Request (group , http .MethodPost , path , request )
77
- if err != nil {
75
+ if err := c .Request (group , http .MethodPost , path , request ); err != nil {
78
76
return nil , err
79
77
}
80
78
@@ -104,7 +102,6 @@ func List(c *messagebird.Client, options *ListOptions) (*GroupList, error) {
104
102
}
105
103
106
104
groupList := & GroupList {}
107
-
108
105
if err := c .Request (groupList , http .MethodGet , path + "?" + query , nil ); err != nil {
109
106
return nil , err
110
107
}
@@ -132,9 +129,7 @@ func listQuery(options *ListOptions) (string, error) {
132
129
// Read retrieves the information of an existing group.
133
130
func Read (c * messagebird.Client , id string ) (* Group , error ) {
134
131
group := & Group {}
135
-
136
- err := c .Request (group , http .MethodGet , path + "/" + id , nil )
137
- if err != nil {
132
+ if err := c .Request (group , http .MethodGet , path + "/" + id , nil ); err != nil {
138
133
return nil , err
139
134
}
140
135
@@ -165,7 +160,6 @@ func AddContacts(c *messagebird.Client, groupID string, contactIDS []string) err
165
160
}
166
161
167
162
query := addContactsQuery (contactIDS )
168
-
169
163
formattedPath := fmt .Sprintf ("%s/%s/%s?%s" , path , groupID , contactPath , query )
170
164
171
165
return c .Request (nil , http .MethodGet , formattedPath , nil )
@@ -194,7 +188,6 @@ func validateAddContacts(contactIDS []string) error {
194
188
func addContactsQuery (contactIDS []string ) string {
195
189
// Slice's length is one bigger than len(IDs) for the _method param.
196
190
params := make ([]string , 0 , len (contactIDS )+ 1 )
197
-
198
191
params = append (params , "_method=" + http .MethodPut )
199
192
200
193
for _ , contactID := range contactIDS {
@@ -214,10 +207,7 @@ func ListContacts(c *messagebird.Client, groupID string, options *ListOptions) (
214
207
formattedPath := fmt .Sprintf ("%s/%s/%s?%s" , path , groupID , contactPath , query )
215
208
216
209
contacts := & contact.ContactList {}
217
-
218
- err = c .Request (contacts , http .MethodGet , formattedPath , nil )
219
-
220
- if err != nil {
210
+ if err = c .Request (contacts , http .MethodGet , formattedPath , nil ); err != nil {
221
211
return nil , err
222
212
}
223
213
0 commit comments