Commit 8119a0ed authored by Greg Messner's avatar Greg Messner
Browse files

Added setProjectAvatar() (#284).

parent 4a7bb823
...@@ -2387,4 +2387,34 @@ public class ProjectApi extends AbstractApi implements Constants { ...@@ -2387,4 +2387,34 @@ public class ProjectApi extends AbstractApi implements Constants {
Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "transfer"); Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "transfer");
return (response.readEntity(Project.class)); return (response.readEntity(Project.class));
} }
/**
* Uploads and sets the project avatar for the specified project
*
* <pre><code>PUT /projects/:id/uploads</code></pre>
*
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param avatarFile the File instance of the avatar file to upload
* @return the updated Project instance
* @throws GitLabApiException if any exception occurs
*/
public Project setProjectAvatar(Object projectIdOrPath, File fileToUpload) throws GitLabApiException {
return (setProjectAvatar(projectIdOrPath, fileToUpload, null));
}
/**
* Uploads and sets the project avatar for the specified project.
*
* <pre><code>PUT /projects/:id/uploads</code></pre>
*
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param avatarFile the File instance of the avatar file to upload
* @param mediaType the media type of the avatar file to upload, optional
* @return the updated Project instance
* @throws GitLabApiException if any exception occurs
*/
public Project setProjectAvatar(Object projectIdOrPath, File avatarFile, String mediaType) throws GitLabApiException {
Response response = putUpload(Response.Status.OK, "avatar", avatarFile, mediaType, "projects", getProjectIdOrPath(projectIdOrPath));
return (response.readEntity(Project.class));
}
} }
\ No newline at end of file
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