Skip to content

Commit d839d8e

Browse files
committed
Added withParam() method that takes AccessLevel as the value (#223).
1 parent 8c7ac21 commit d839d8e

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import javax.ws.rs.core.Form;
77
import javax.ws.rs.core.MultivaluedHashMap;
88

9+
import org.gitlab4j.api.models.AccessLevel;
910
import org.gitlab4j.api.utils.ISO8601;
1011

1112
/**
@@ -68,6 +69,30 @@ public GitLabApiForm withParam(String name, Date date, boolean required) throws
6869
return (withParam(name, (date == null ? null : ISO8601.toString(date)), required));
6970
}
7071

72+
/**
73+
* Fluent method for adding AccessLevel query and form parameters to a get() or post() call.
74+
*
75+
* @param name the name of the field/attribute to add
76+
* @param date the value of the field/attribute to add
77+
* @return this GitLabAPiForm instance
78+
*/
79+
public GitLabApiForm withParam(String name, AccessLevel level) throws IllegalArgumentException {
80+
return (withParam(name, level, false));
81+
}
82+
83+
/**
84+
* Fluent method for adding AccessLevel query and form parameters to a get() or post() call.
85+
*
86+
* @param name the name of the field/attribute to add
87+
* @param level the value of the field/attribute to add
88+
* @param required the field is required flag
89+
* @return this GitLabAPiForm instance
90+
* @throws IllegalArgumentException if a required parameter is null or empty
91+
*/
92+
public GitLabApiForm withParam(String name, AccessLevel level, boolean required) throws IllegalArgumentException {
93+
return (withParam(name, (level == null ? null : level.toValue()), required));
94+
}
95+
7196
/**
7297
* Fluent method for adding a List type query and form parameters to a get() or post() call.
7398
*

0 commit comments

Comments
 (0)