Commit 2c58b56f authored by Greg Messner's avatar Greg Messner
Browse files

Completed Javadocs.

parent d099773e
...@@ -7,6 +7,13 @@ import javax.ws.rs.core.MultivaluedMap; ...@@ -7,6 +7,13 @@ import javax.ws.rs.core.MultivaluedMap;
import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.representation.Form; import com.sun.jersey.api.representation.Form;
/**
* This class is the base class for all the sub API classes. It provides implementations of
* delete(), get(), post() and put() that are re-used by all the sub-classes.
*
* @author Greg Messner <greg@messners.com>
*
*/
public abstract class AbstractApi { public abstract class AbstractApi {
private GitLabApi gitLabApi; private GitLabApi gitLabApi;
...@@ -17,8 +24,7 @@ public abstract class AbstractApi { ...@@ -17,8 +24,7 @@ public abstract class AbstractApi {
protected GitLabApiClient getApiClient () { protected GitLabApiClient getApiClient () {
return (gitLabApi.getApiClient()); return (gitLabApi.getApiClient());
} }
/** /**
...@@ -130,8 +136,7 @@ public abstract class AbstractApi { ...@@ -130,8 +136,7 @@ public abstract class AbstractApi {
return (response); return (response);
} }
/** /**
* Perform an HTTP PUT call with the specified form data and path objects, returning * Perform an HTTP PUT call with the specified form data and path objects, returning
* a ClientResponse instance with the data returned from the endpoint. * a ClientResponse instance with the data returned from the endpoint.
...@@ -261,7 +266,7 @@ public abstract class AbstractApi { ...@@ -261,7 +266,7 @@ public abstract class AbstractApi {
* @param name * @param name
* @param value * @param value
* @param required * @param required
* @throws IllegalArgumentException * @throws IllegalArgumentException if a required parameter is null or empty
*/ */
protected void addFormParam(Form formData, String name, Object value, boolean required) throws IllegalArgumentException { protected void addFormParam(Form formData, String name, Object value, boolean required) throws IllegalArgumentException {
......
...@@ -3,9 +3,15 @@ package com.messners.gitlab.api; ...@@ -3,9 +3,15 @@ package com.messners.gitlab.api;
import java.util.List; import java.util.List;
import com.messners.gitlab.api.models.Commit; import com.messners.gitlab.api.models.Commit;
import com.messners.gitlab.api.models.Diff;
import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.GenericType; import com.sun.jersey.api.client.GenericType;
/**
* This class implements the client side API for the GitLab commits calls.
*
* @author Greg Messner <greg@messners.com>
*/
public class CommitsApi extends AbstractApi { public class CommitsApi extends AbstractApi {
public CommitsApi (GitLabApi gitLabApi) { public CommitsApi (GitLabApi gitLabApi) {
...@@ -14,14 +20,49 @@ public class CommitsApi extends AbstractApi { ...@@ -14,14 +20,49 @@ public class CommitsApi extends AbstractApi {
/** /**
* GET /projects/:id/repository/commits/branch * Get a list of repository commits in a project.
* *
* @param branch * GET /projects/:id/repository/commits
*
* @param projectId
* @return * @return
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public List<Commit> getCommits (int projectId, String branch) throws GitLabApiException { public List<Commit> getCommits (int projectId) throws GitLabApiException {
ClientResponse response = get(ClientResponse.Status.OK, null, "projects", projectId, "repository", "commits", branch); ClientResponse response = get(ClientResponse.Status.OK, null, "projects", projectId, "repository", "commits");
return (response.getEntity(new GenericType<List<Commit>>() {})); return (response.getEntity(new GenericType<List<Commit>>() {}));
} }
}
/**
* Get a specific commit identified by the commit hash or name of a branch or tag.
*
* GET /projects/:id/repository/commits/:sha
*
* @param projectId
* @param sha a commit hash or name of a branch or tag
* @return
* @throws GitLabApiException
*/
public Commit getCommits (int projectId, String sha) throws GitLabApiException {
ClientResponse response = get(ClientResponse.Status.OK, null, "projects", projectId, "repository", "commits", sha);
return (response.getEntity(Commit.class));
}
/**
* Get the diff of a commit in a project.
*
* GET /projects/:id/repository/commits/:sha/diff
*
* @param projectId
* @param sha a commit hash or name of a branch or tag
* @return
* @throws GitLabApiException
*/
public Diff getDiff (int projectId, String sha) throws GitLabApiException {
ClientResponse response = get(ClientResponse.Status.OK, null,
"projects", projectId, "repository", "commits", sha, "diff");
return (response.getEntity(Diff.class));
}
}
\ No newline at end of file
...@@ -2,7 +2,8 @@ package com.messners.gitlab.api; ...@@ -2,7 +2,8 @@ package com.messners.gitlab.api;
/** /**
* This class specifies methods to interact with a GitLab server utilizing the standard GitLab API. * This class is provides a simplified interface to a GitLab API server, and divides the API up into
* a separate API class for each concern.
* *
* @author Greg Messner <greg@messners.com> * @author Greg Messner <greg@messners.com>
*/ */
...@@ -19,7 +20,7 @@ public class GitLabApi { ...@@ -19,7 +20,7 @@ public class GitLabApi {
/** /**
* Contructs a GitLabApi instance set up to interact with the GitLab server * Constructs a GitLabApi instance set up to interact with the GitLab server
* specified by hostUrl. * specified by hostUrl.
* *
* @param hostUrl * @param hostUrl
...@@ -94,7 +95,7 @@ public class GitLabApi { ...@@ -94,7 +95,7 @@ public class GitLabApi {
/** /**
* Gets the RepositoryApi instance owned by this GitLabApi instance. The RepositoryApi is used * Gets the RepositoryApi instance owned by this GitLabApi instance. The RepositoryApi is used
* to perform all user related API calls. * to perform all repository related API calls.
* *
* @return the RepositoryApi instance owned by this GitLabApi instance * @return the RepositoryApi instance owned by this GitLabApi instance
*/ */
......
...@@ -5,6 +5,14 @@ import javax.ws.rs.core.Response.StatusType; ...@@ -5,6 +5,14 @@ import javax.ws.rs.core.Response.StatusType;
import com.messners.gitlab.api.models.ErrorMessage; import com.messners.gitlab.api.models.ErrorMessage;
import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.ClientResponse;
/**
* This is the exception that will be thrown if any exception occurs while communicating
* with a GitLab API endpoint.
*
* @author Greg Messner <greg@messners.com>
*
*/
public class GitLabApiException extends Exception { public class GitLabApiException extends Exception {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -14,7 +22,7 @@ public class GitLabApiException extends Exception { ...@@ -14,7 +22,7 @@ public class GitLabApiException extends Exception {
private String message; private String message;
/** /**
* Create a GitLabApiException based on the ClientResponse. * Create a GitLabApiException instance based on the ClientResponse.
* *
* @param response * @param response
*/ */
...@@ -35,6 +43,10 @@ public class GitLabApiException extends Exception { ...@@ -35,6 +43,10 @@ public class GitLabApiException extends Exception {
} }
/**
* Create a GitLabApiException instance based on the exception.
* @param e
*/
public GitLabApiException (Exception e) { public GitLabApiException (Exception e) {
super(e); super(e);
message = e.getMessage(); message = e.getMessage();
...@@ -56,7 +68,7 @@ public class GitLabApiException extends Exception { ...@@ -56,7 +68,7 @@ public class GitLabApiException extends Exception {
* Returns the HTTP status reason message, returns null if the * Returns the HTTP status reason message, returns null if the
* causing error was not an HTTP related exception. * causing error was not an HTTP related exception.
* *
* @return * @return the HTTP status reason message
*/ */
public final String getReason () { public final String getReason () {
return (statusInfo != null ? statusInfo.getReasonPhrase() : null); return (statusInfo != null ? statusInfo.getReasonPhrase() : null);
...@@ -64,10 +76,10 @@ public class GitLabApiException extends Exception { ...@@ -64,10 +76,10 @@ public class GitLabApiException extends Exception {
/** /**
* Returns the HTTP status code. returns 0 if the * Returns the HTTP status code that was the cause of the exception. returns 0 if the
* causing error was not an HTTP related exception. * causing error was not an HTTP related exception.
* *
* @return * @return the HTTP status code, returns 0 if the causing error was not an HTTP related exception
*/ */
public final int getHttpStatus () { public final int getHttpStatus () {
return (httpStatus); return (httpStatus);
......
...@@ -8,6 +8,11 @@ import com.sun.jersey.api.client.ClientResponse; ...@@ -8,6 +8,11 @@ import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.GenericType; import com.sun.jersey.api.client.GenericType;
import com.sun.jersey.api.representation.Form; import com.sun.jersey.api.representation.Form;
/**
* This class implements the client side API for the GitLab groups calls.
*
* @author Greg Messner <greg@messners.com>
*/
public class GroupApi extends AbstractApi { public class GroupApi extends AbstractApi {
GroupApi (GitLabApi gitLabApi) { GroupApi (GitLabApi gitLabApi) {
...@@ -20,7 +25,7 @@ public class GroupApi extends AbstractApi { ...@@ -20,7 +25,7 @@ public class GroupApi extends AbstractApi {
* *
* GET /groups * GET /groups
* *
* @return * @return the list of groups viewable by the authenticated user
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public List<Group> getGroups () throws GitLabApiException { public List<Group> getGroups () throws GitLabApiException {
...@@ -35,7 +40,7 @@ public class GroupApi extends AbstractApi { ...@@ -35,7 +40,7 @@ public class GroupApi extends AbstractApi {
* GET /groups/:id * GET /groups/:id
* *
* @param groupId * @param groupId
* @return * @return the Group instance for the specified group ID
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public Group getGroup (int groupId) throws GitLabApiException { public Group getGroup (int groupId) throws GitLabApiException {
...@@ -97,7 +102,7 @@ public class GroupApi extends AbstractApi { ...@@ -97,7 +102,7 @@ public class GroupApi extends AbstractApi {
* *
* GET /groups/:id/members * GET /groups/:id/members
* *
* @return * @return a list of group members viewable by the authenticated user
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public List<Member> getMembers (int groupId) throws GitLabApiException { public List<Member> getMembers (int groupId) throws GitLabApiException {
...@@ -113,7 +118,7 @@ public class GroupApi extends AbstractApi { ...@@ -113,7 +118,7 @@ public class GroupApi extends AbstractApi {
* @param groupId * @param groupId
* @param userId * @param userId
* @param accessLevel * @param accessLevel
* @return * @return a Member instance for the added user
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public Member addMember (Integer groupId, Integer userId, Integer accessLevel) throws GitLabApiException { public Member addMember (Integer groupId, Integer userId, Integer accessLevel) throws GitLabApiException {
......
...@@ -6,6 +6,11 @@ import java.util.Calendar; ...@@ -6,6 +6,11 @@ import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.TimeZone; import java.util.TimeZone;
/**
* This class provides utility methods for parsing and formatting ISO8601 formatted dates.
*
* @author Greg Messner <greg@messners.com>
*/
public class ISO8601 { public class ISO8601 {
public static final String PATTERN = "yyyy-MM-dd'T'HH:mm:ssZ"; public static final String PATTERN = "yyyy-MM-dd'T'HH:mm:ssZ";
public static final String OUTPUT_PATTERN = "yyyy-MM-dd'T'HH:mm:ss'Z'"; public static final String OUTPUT_PATTERN = "yyyy-MM-dd'T'HH:mm:ss'Z'";
...@@ -26,10 +31,23 @@ public class ISO8601 { ...@@ -26,10 +31,23 @@ public class ISO8601 {
iso8601AlternateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); iso8601AlternateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
} }
/**
* Get a ISO8601 formatted string for the current date and time.
*
* @return a ISO8601 formatted string for the current date and time
*/
public static String getTimestamp () { public static String getTimestamp () {
return iso8601Format.format(new Date()); return iso8601Format.format(new Date());
} }
/**
* Get a ISO8601 formatted string for the provided Calendar instance.
*
* @param cal the Calendar instance to get the ISO8601 formatted string for
* @return a ISO8601 formatted string for the provided Calendar instance, or null if call is null
*/
public static String toString (Calendar cal) { public static String toString (Calendar cal) {
if (cal == null) { if (cal == null) {
...@@ -39,6 +57,13 @@ public class ISO8601 { ...@@ -39,6 +57,13 @@ public class ISO8601 {
return toString(cal.getTime()); return toString(cal.getTime());
} }
/**
* Get a ISO8601 formatted string for the provided Date instance.
*
* @param date the Date instance to get the ISO8601 formatted string for
* @return a ISO8601 formatted string for the provided Date instance, or null if date is null
*/
public static synchronized String toString (Date date) { public static synchronized String toString (Date date) {
if (date == null) { if (date == null) {
...@@ -48,6 +73,14 @@ public class ISO8601 { ...@@ -48,6 +73,14 @@ public class ISO8601 {
return iso8601OutputFormat.format(date); return iso8601OutputFormat.format(date);
} }
/**
* Parses an ISO8601 formatted string a returns a Date instance.
*
* @param dateTimeString the ISO8601 formatted string
* @return a Date instance for the ISO8601 formatted string
* @throws ParseException if the provided string is not in the proper format
*/
public static Date toDate (String dateTimeString) throws ParseException { public static Date toDate (String dateTimeString) throws ParseException {
if (dateTimeString == null) { if (dateTimeString == null) {
...@@ -69,6 +102,14 @@ public class ISO8601 { ...@@ -69,6 +102,14 @@ public class ISO8601 {
} }
} }
/**
* Parses an ISO8601 formatted string a returns a Calendar instance.
*
* @param dateTimeString the ISO8601 formatted string
* @return a Calendar instance for the ISO8601 formatted string
* @throws ParseException if the provided string is not in the proper format
*/
public static Calendar toCalendar (String dateTimeString) throws ParseException { public static Calendar toCalendar (String dateTimeString) throws ParseException {
Date date = toDate(dateTimeString); Date date = toDate(dateTimeString);
......
...@@ -64,18 +64,20 @@ public class JacksonJson extends JacksonJaxbJsonProvider implements ContextResol ...@@ -64,18 +64,20 @@ public class JacksonJson extends JacksonJaxbJsonProvider implements ContextResol
/** /**
* Gets the ObjectMapper contained by this instance.
* *
* @return * @return the ObjectMapper contained by this instance
*/ */
public ObjectMapper getObjectMapper () { public ObjectMapper getObjectMapper () {
return (objectMapper); return (objectMapper);
} }
/** /**
* Unmarshal the JSON data on the specified Reader instance to an instance of the provided class.
* *
* @param returnType * @param returnType an instance of this type class will be returned
* @param reader * @param reader the Reader instance that contains the JSON data
* @return * @return an instance of the provided class containing the parsed data from the Reader
* @throws JsonParseException * @throws JsonParseException
* @throws JsonMappingException * @throws JsonMappingException
* @throws IOException * @throws IOException
...@@ -87,10 +89,11 @@ public class JacksonJson extends JacksonJaxbJsonProvider implements ContextResol ...@@ -87,10 +89,11 @@ public class JacksonJson extends JacksonJaxbJsonProvider implements ContextResol
} }
/** /**
* * Unmarshal the JSON data contained by the string and populate an instance of the provided returnType class.
* @param returnType *
* @param returnType an instance of this type class will be returned
* @param postData * @param postData
* @return * @return an instance of the provided class containing the parsed data from the string
* @throws JsonParseException * @throws JsonParseException
* @throws JsonMappingException * @throws JsonMappingException
* @throws IOException * @throws IOException
...@@ -105,7 +108,7 @@ public class JacksonJson extends JacksonJaxbJsonProvider implements ContextResol ...@@ -105,7 +108,7 @@ public class JacksonJson extends JacksonJaxbJsonProvider implements ContextResol
/** /**
* Marshals the supplied object out as a formatted JSON string. * Marshals the supplied object out as a formatted JSON string.
* *
* @param object * @param object the object to output as a JSON string
* @return * @return
*/ */
public <T> String marshal (final T object) { public <T> String marshal (final T object) {
...@@ -131,6 +134,9 @@ public class JacksonJson extends JacksonJaxbJsonProvider implements ContextResol ...@@ -131,6 +134,9 @@ public class JacksonJson extends JacksonJaxbJsonProvider implements ContextResol
} }
/**
* JsonSerializer for serializing ISO8601 formatted dates.
*/
public static class JsonDateSerializer extends JsonSerializer<Date> { public static class JsonDateSerializer extends JsonSerializer<Date> {
@Override @Override
......
...@@ -9,7 +9,8 @@ import com.sun.jersey.api.client.GenericType; ...@@ -9,7 +9,8 @@ import com.sun.jersey.api.client.GenericType;
import com.sun.jersey.api.representation.Form; import com.sun.jersey.api.representation.Form;
/** /**
* * This class implements the client side API for the GitLab merge request calls.
*
* @author Greg Messner <greg@messners.com> * @author Greg Messner <greg@messners.com>
*/ */
public class MergeRequestApi extends AbstractApi { public class MergeRequestApi extends AbstractApi {
...@@ -20,12 +21,12 @@ public class MergeRequestApi extends AbstractApi { ...@@ -20,12 +21,12 @@ public class MergeRequestApi extends AbstractApi {
/** /**
* Get all merge requests for this project. * Get all merge requests for the specified project.
* *
* GET /projects/:id/merge_requests * GET /projects/:id/merge_requests
* *
* @param projectId * @param projectId the project ID to get the merge requests for
* @return * @return all merge requests for the specified project
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public List<MergeRequest> getMergeRequests (Integer projectId) throws GitLabApiException { public List<MergeRequest> getMergeRequests (Integer projectId) throws GitLabApiException {
...@@ -95,7 +96,7 @@ public class MergeRequestApi extends AbstractApi { ...@@ -95,7 +96,7 @@ public class MergeRequestApi extends AbstractApi {
* @param title * @param title
* @param description * @param description
* @param assigneeId * @param assigneeId
* @return * @return the updated merge request
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public MergeRequest updateMergeRequest (Integer projectId, Integer mergeRequestId, public MergeRequest updateMergeRequest (Integer projectId, Integer mergeRequestId,
...@@ -129,7 +130,7 @@ public class MergeRequestApi extends AbstractApi { ...@@ -129,7 +130,7 @@ public class MergeRequestApi extends AbstractApi {
* @param projectId * @param projectId
* @param mergeRequestId * @param mergeRequestId
* @param comments * @param comments
* @return * @return the added merge request comment
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public MergeRequestComment addMergeRequestComment (Integer projectId, Integer mergeRequestId, String comments) throws GitLabApiException { public MergeRequestComment addMergeRequestComment (Integer projectId, Integer mergeRequestId, String comments) throws GitLabApiException {
......
...@@ -24,7 +24,7 @@ public class ProjectApi extends AbstractApi { ...@@ -24,7 +24,7 @@ public class ProjectApi extends AbstractApi {
* *
* GET /projects * GET /projects
* *
* @return * @return a list of projects accessible by the authenticated user
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public List<Project> getProjects () throws GitLabApiException { public List<Project> getProjects () throws GitLabApiException {
...@@ -38,7 +38,7 @@ public class ProjectApi extends AbstractApi { ...@@ -38,7 +38,7 @@ public class ProjectApi extends AbstractApi {
* *
* GET /projects/all * GET /projects/all
* *
* @return * @return a list of all GitLab projects
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public List<Project> getAllProjects () throws GitLabApiException { public List<Project> getAllProjects () throws GitLabApiException {
...@@ -52,7 +52,7 @@ public class ProjectApi extends AbstractApi { ...@@ -52,7 +52,7 @@ public class ProjectApi extends AbstractApi {
* *
* GET /projects/owned * GET /projects/owned
* *
* @return * @return a list of projects owned by the authenticated user
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public List<Project> getOwnedProjects () throws GitLabApiException { public List<Project> getOwnedProjects () throws GitLabApiException {
...@@ -67,7 +67,7 @@ public class ProjectApi extends AbstractApi { ...@@ -67,7 +67,7 @@ public class ProjectApi extends AbstractApi {
* GET /projects/:id * GET /projects/:id
* *
* @param projectId * @param projectId
* @return * @return the specified project
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public Project getProject (Integer projectId) throws GitLabApiException { public Project getProject (Integer projectId) throws GitLabApiException {
...@@ -83,7 +83,7 @@ public class ProjectApi extends AbstractApi { ...@@ -83,7 +83,7 @@ public class ProjectApi extends AbstractApi {
* *
* @param group * @param group
* @param project * @param project
* @return * @return the specified project
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public Project getProject (String group, String project) throws GitLabApiException { public Project getProject (String group, String project) throws GitLabApiException {
...@@ -105,7 +105,7 @@ public class ProjectApi extends AbstractApi { ...@@ -105,7 +105,7 @@ public class ProjectApi extends AbstractApi {
* *
* @param groupId * @param groupId
* @param projectName * @param projectName
* @return * @return the created project
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public Project createProject (Integer groupId, String projectName) throws GitLabApiException { public Project createProject (Integer groupId, String projectName) throws GitLabApiException {
...@@ -219,7 +219,7 @@ public class ProjectApi extends AbstractApi { ...@@ -219,7 +219,7 @@ public class ProjectApi extends AbstractApi {
* GET /projects/:id/members * GET /projects/:id/members
* *
* @param projectId * @param projectId
* @return * @return the members belonging to the specified project
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public List<Member> getMembers (Integer projectId) throws GitLabApiException { public List<Member> getMembers (Integer projectId) throws GitLabApiException {
...@@ -235,7 +235,7 @@ public class ProjectApi extends AbstractApi { ...@@ -235,7 +235,7 @@ public class ProjectApi extends AbstractApi {
* *
* @param projectId * @param projectId
* @param userId * @param userId
* @return * @return the member specified by the project ID/user ID pair
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public Member getMember (Integer projectId, Integer userId) throws GitLabApiException { public Member getMember (Integer projectId, Integer userId) throws GitLabApiException {
...@@ -254,7 +254,7 @@ public class ProjectApi extends AbstractApi { ...@@ -254,7 +254,7 @@ public class ProjectApi extends AbstractApi {
* @param projectId * @param projectId
* @param userId * @param userId
* @param accessLevel * @param accessLevel
* @return * @return the added member
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public Member addMember (Integer projectId, Integer userId, Integer accessLevel) throws GitLabApiException { public Member addMember (Integer projectId, Integer userId, Integer accessLevel) throws GitLabApiException {
...@@ -276,9 +276,8 @@ public class ProjectApi extends AbstractApi { ...@@ -276,9 +276,8 @@ public class ProjectApi extends AbstractApi {
* @param userId * @param userId
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public boolean removeMember (Integer projectId, Integer userId) throws GitLabApiException { public void removeMember (Integer projectId, Integer userId) throws GitLabApiException {
ClientResponse response = delete(ClientResponse.Status.OK, null, "projects", projectId, "members", userId); delete(ClientResponse.Status.OK, null, "projects", projectId, "members", userId);
return (response.getStatus() == ClientResponse.Status.OK.getStatusCode());
} }
...@@ -288,7 +287,7 @@ public class ProjectApi extends AbstractApi { ...@@ -288,7 +287,7 @@ public class ProjectApi extends AbstractApi {
* GET /projects/:id/events * GET /projects/:id/events
* *
* @param projectId * @param projectId
* @return * @return the project events for the specified project
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public List<Event> getProjectEvents (Integer projectId) throws GitLabApiException { public List<Event> getProjectEvents (Integer projectId) throws GitLabApiException {
...@@ -303,7 +302,7 @@ public class ProjectApi extends AbstractApi { ...@@ -303,7 +302,7 @@ public class ProjectApi extends AbstractApi {
* GET /projects/:id/hooks * GET /projects/:id/hooks
* *
* @param projectId * @param projectId
* @return * @return a list of project hooks for the specified project
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public List<ProjectHook> getHooks (Integer projectId) throws GitLabApiException { public List<ProjectHook> getHooks (Integer projectId) throws GitLabApiException {
...@@ -319,7 +318,7 @@ public class ProjectApi extends AbstractApi { ...@@ -319,7 +318,7 @@ public class ProjectApi extends AbstractApi {
* *
* @param projectId * @param projectId
* @param hookId * @param hookId
* @return * @return the project hook for the specified project ID/hook ID pair
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public ProjectHook getHook (Integer projectId, Integer hookId) throws GitLabApiException { public ProjectHook getHook (Integer projectId, Integer hookId) throws GitLabApiException {
...@@ -338,7 +337,7 @@ public class ProjectApi extends AbstractApi { ...@@ -338,7 +337,7 @@ public class ProjectApi extends AbstractApi {
* @param doPushEvents * @param doPushEvents
* @param doIssuesEvents * @param doIssuesEvents
* @param doMergeRequestsEvents * @param doMergeRequestsEvents
* @return * @return the added project hook
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public ProjectHook addHook (Project project, String url, public ProjectHook addHook (Project project, String url,
...@@ -363,7 +362,7 @@ public class ProjectApi extends AbstractApi { ...@@ -363,7 +362,7 @@ public class ProjectApi extends AbstractApi {
* @param doPushEvents * @param doPushEvents
* @param doIssuesEvents * @param doIssuesEvents
* @param doMergeRequestsEvents * @param doMergeRequestsEvents
* @return * @return the added project hook
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public ProjectHook addHook (Integer projectId, String url, public ProjectHook addHook (Integer projectId, String url,
...@@ -418,11 +417,10 @@ public class ProjectApi extends AbstractApi { ...@@ -418,11 +417,10 @@ public class ProjectApi extends AbstractApi {
* @param doPushEvents * @param doPushEvents
* @param doIssuesEvents * @param doIssuesEvents
* @param doMergeRequestsEvents * @param doMergeRequestsEvents
* @return * @return the modified project hook
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public ProjectHook modifyHook (ProjectHook hook) public ProjectHook modifyHook (ProjectHook hook) throws GitLabApiException {
throws GitLabApiException {
Form formData = new Form(); Form formData = new Form();
formData.add("url", hook.getUrl()); formData.add("url", hook.getUrl());
......
...@@ -28,7 +28,7 @@ public class RepositoryApi extends AbstractApi { ...@@ -28,7 +28,7 @@ public class RepositoryApi extends AbstractApi {
* GET /projects/:id/repository/branches * GET /projects/:id/repository/branches
* *
* @param projectId * @param projectId
* @return * @return the list of repository branches for mthe specified project ID
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public List<Branch> getBranches (Integer projectId) throws GitLabApiException { public List<Branch> getBranches (Integer projectId) throws GitLabApiException {
...@@ -44,7 +44,7 @@ public class RepositoryApi extends AbstractApi { ...@@ -44,7 +44,7 @@ public class RepositoryApi extends AbstractApi {
* *
* @param projectId * @param projectId
* @param branchName * @param branchName
* @return * @return the branch info for the specified project ID/branch name pair
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public Branch getBranch (Integer projectId, String branchName) throws GitLabApiException { public Branch getBranch (Integer projectId, String branchName) throws GitLabApiException {
...@@ -61,7 +61,7 @@ public class RepositoryApi extends AbstractApi { ...@@ -61,7 +61,7 @@ public class RepositoryApi extends AbstractApi {
* *
* @param projectId * @param projectId
* @param branchName * @param branchName
* @return * @return the branch info for the protected branch
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public Branch protectBranch (Integer projectId, String branchName) throws GitLabApiException { public Branch protectBranch (Integer projectId, String branchName) throws GitLabApiException {
...@@ -78,7 +78,7 @@ public class RepositoryApi extends AbstractApi { ...@@ -78,7 +78,7 @@ public class RepositoryApi extends AbstractApi {
* *
* @param projectId * @param projectId
* @param branchName * @param branchName
* @return * @return the branch info for the unprotected branch
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public Branch unprotectBranch (Integer projectId, String branchName) throws GitLabApiException { public Branch unprotectBranch (Integer projectId, String branchName) throws GitLabApiException {
...@@ -93,7 +93,7 @@ public class RepositoryApi extends AbstractApi { ...@@ -93,7 +93,7 @@ public class RepositoryApi extends AbstractApi {
* GET /projects/:id/repository/tags * GET /projects/:id/repository/tags
* *
* @param projectId * @param projectId
* @return * @return the list of tags for the specified project ID
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public List<Tag> getTags (Integer projectId) throws GitLabApiException { public List<Tag> getTags (Integer projectId) throws GitLabApiException {
...@@ -108,12 +108,12 @@ public class RepositoryApi extends AbstractApi { ...@@ -108,12 +108,12 @@ public class RepositoryApi extends AbstractApi {
* GET /projects/:id/repository/tree * GET /projects/:id/repository/tree
* *
* @param projectId * @param projectId
* @return * @return a tree with the diurectories and files of a project
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public List<TreeItem> getTree (Integer projectId) throws GitLabApiException { public List<TreeItem> getTree (Integer projectId) throws GitLabApiException {
ClientResponse response = put(ClientResponse.Status.OK, null, "projects", projectId, "repository", "tree"); ClientResponse response = put(ClientResponse.Status.OK, null, "projects", projectId, "repository", "tree");
return (response.getEntity(new GenericType<List<TreeItem>>() {})); return (response.getEntity(new GenericType<List<TreeItem>>() {}));
} }
...@@ -124,7 +124,7 @@ public class RepositoryApi extends AbstractApi { ...@@ -124,7 +124,7 @@ public class RepositoryApi extends AbstractApi {
* *
* @param projectId * @param projectId
* @param commitOrBranchName * @param commitOrBranchName
* @return * @return a string with the file content for the specified file
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public String getRawFileContent (Integer projectId, String commitOrBranchName, String filepath) throws GitLabApiException { public String getRawFileContent (Integer projectId, String commitOrBranchName, String filepath) throws GitLabApiException {
......
...@@ -26,7 +26,7 @@ public class SessionApi extends AbstractApi { ...@@ -26,7 +26,7 @@ public class SessionApi extends AbstractApi {
* @param username * @param username
* @param email * @param email
* @param password * @param password
* @return * @return a Session instance with info on the logged in user
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public Session login (String username, String email, String password) throws GitLabApiException { public Session login (String username, String email, String password) throws GitLabApiException {
......
...@@ -19,7 +19,7 @@ public class UserApi extends AbstractApi { ...@@ -19,7 +19,7 @@ public class UserApi extends AbstractApi {
* *
* GET /users * GET /users
* *
* @return * @return a list of Users, this list will only contain the first 20 users in the system.
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public List<User> getUsers () throws GitLabApiException { public List<User> getUsers () throws GitLabApiException {
...@@ -35,7 +35,7 @@ public class UserApi extends AbstractApi { ...@@ -35,7 +35,7 @@ public class UserApi extends AbstractApi {
* *
* @param page * @param page
* @param perPage * @param perPage
* @return * @return the list of Users in the specified range
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public List<User> getUsers (int page, int perPage) throws GitLabApiException { public List<User> getUsers (int page, int perPage) throws GitLabApiException {
...@@ -54,7 +54,7 @@ public class UserApi extends AbstractApi { ...@@ -54,7 +54,7 @@ public class UserApi extends AbstractApi {
* GET /users/:id * GET /users/:id
* *
* @param userId * @param userId
* @return * @return the User instance for the specified user ID
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public User getUser (int userId) throws GitLabApiException { public User getUser (int userId) throws GitLabApiException {
...@@ -84,7 +84,7 @@ public class UserApi extends AbstractApi { ...@@ -84,7 +84,7 @@ public class UserApi extends AbstractApi {
* can_create_group (optional) - User can create groups - true or false * can_create_group (optional) - User can create groups - true or false
* *
* @param user * @param user
* @return * @return created User instance
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public User createUser (User user, String password, Integer projectsLimit) throws GitLabApiException { public User createUser (User user, String password, Integer projectsLimit) throws GitLabApiException {
...@@ -131,7 +131,7 @@ public class UserApi extends AbstractApi { ...@@ -131,7 +131,7 @@ public class UserApi extends AbstractApi {
* can_create_group (optional) - User can create groups - true or false * can_create_group (optional) - User can create groups - true or false
* *
* @param user * @param user
* @return * @return the modified User instance
* @throws GitLabApiException * @throws GitLabApiException
*/ */
public User modifyUser (User user, String password, Integer projectsLimit) throws GitLabApiException { public User modifyUser (User user, String password, Integer projectsLimit) throws GitLabApiException {
......
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