Skip to content

Commit 7b6f8b3

Browse files
committed
Fixed blockUser() and unblockUser() for V3 (#251).
1 parent 880b5a3 commit 7b6f8b3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/main/java/org/gitlab4j/api/UserApi.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,11 @@ public void blockUser(Integer userId) throws GitLabApiException {
127127
throw new RuntimeException("userId cannot be null");
128128
}
129129

130-
post(Response.Status.CREATED, (Form) null, "users", userId, "block");
130+
if (isApiVersion(ApiVersion.V3)) {
131+
put(Response.Status.CREATED, null, "users", userId, "block");
132+
} else {
133+
post(Response.Status.CREATED, (Form) null, "users", userId, "block");
134+
}
131135
}
132136

133137
/**
@@ -144,7 +148,11 @@ public void unblockUser(Integer userId) throws GitLabApiException {
144148
throw new RuntimeException("userId cannot be null");
145149
}
146150

147-
post(Response.Status.CREATED, (Form) null, "users", userId, "unblock");
151+
if (isApiVersion(ApiVersion.V3)) {
152+
put(Response.Status.CREATED, null, "users", userId, "unblock");
153+
} else {
154+
post(Response.Status.CREATED, (Form) null, "users", userId, "unblock");
155+
}
148156
}
149157

150158
/**

0 commit comments

Comments
 (0)