Commit d839d8ec authored by Greg Messner's avatar Greg Messner
Browse files

Added withParam() method that takes AccessLevel as the value (#223).

parent 8c7ac21f
...@@ -6,6 +6,7 @@ import java.util.List; ...@@ -6,6 +6,7 @@ import java.util.List;
import javax.ws.rs.core.Form; import javax.ws.rs.core.Form;
import javax.ws.rs.core.MultivaluedHashMap; import javax.ws.rs.core.MultivaluedHashMap;
import org.gitlab4j.api.models.AccessLevel;
import org.gitlab4j.api.utils.ISO8601; import org.gitlab4j.api.utils.ISO8601;
/** /**
...@@ -68,6 +69,30 @@ public class GitLabApiForm extends Form { ...@@ -68,6 +69,30 @@ public class GitLabApiForm extends Form {
return (withParam(name, (date == null ? null : ISO8601.toString(date)), required)); return (withParam(name, (date == null ? null : ISO8601.toString(date)), required));
} }
/**
* Fluent method for adding AccessLevel query and form parameters to a get() or post() call.
*
* @param name the name of the field/attribute to add
* @param date the value of the field/attribute to add
* @return this GitLabAPiForm instance
*/
public GitLabApiForm withParam(String name, AccessLevel level) throws IllegalArgumentException {
return (withParam(name, level, false));
}
/**
* Fluent method for adding AccessLevel query and form parameters to a get() or post() call.
*
* @param name the name of the field/attribute to add
* @param level the value of the field/attribute to add
* @param required the field is required flag
* @return this GitLabAPiForm instance
* @throws IllegalArgumentException if a required parameter is null or empty
*/
public GitLabApiForm withParam(String name, AccessLevel level, boolean required) throws IllegalArgumentException {
return (withParam(name, (level == null ? null : level.toValue()), required));
}
/** /**
* Fluent method for adding a List type query and form parameters to a get() or post() call. * Fluent method for adding a List type query and form parameters to a get() or post() call.
* *
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment