Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete GroupApi#uploadFile(..) method #1200

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 0 additions & 64 deletions src/main/java/org/gitlab4j/api/GroupApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -2454,68 +2454,4 @@ public List<UploadedFile> getUploadFiles(Object groupIdOrPath) throws GitLabApiE
Response response = get(Response.Status.OK, null, "groups", getGroupIdOrPath(groupIdOrPath), "uploads");
return (response.readEntity(new GenericType<List<UploadedFile>>() {}));
}

/**
* Uploads a file to the specified group to be used in an issue or merge request description, or a comment.
*
* <pre><code>GitLab Endpoint: POST /groups/:id/uploads</code></pre>
*
* @param groupIdOrPath the group in the form of an Long(ID), String(path), or Group instance, required
* @param fileToUpload the File instance of the file to upload, required
* @return a FileUpload instance with information on the just uploaded file
* @throws GitLabApiException if any exception occurs
*/
public FileUpload uploadFile(Object groupIdOrPath, File fileToUpload) throws GitLabApiException {
return (uploadFile(groupIdOrPath, fileToUpload, null));
}

/**
* Uploads a file to the specified group to be used in an issue or merge request description, or a comment.
*
* <pre><code>GitLab Endpoint: POST /groups/:id/uploads</code></pre>
*
* @param groupIdOrPath the group in the form of an Long(ID), String(path), or Group instance, required
* @param fileToUpload the File instance of the file to upload, required
* @param mediaType unused; will be removed in the next major version
* @return a FileUpload instance with information on the just uploaded file
* @throws GitLabApiException if any exception occurs
*/
public FileUpload uploadFile(Object groupIdOrPath, File fileToUpload, String mediaType) throws GitLabApiException {
Response response = upload(
Response.Status.CREATED,
"file",
fileToUpload,
mediaType,
"groups",
getGroupIdOrPath(groupIdOrPath),
"uploads");
return (response.readEntity(FileUpload.class));
}

/**
* Uploads some data in an {@link InputStream} to the specified group,
* to be used in an issue or merge request description, or a comment.
*
* <pre><code>GitLab Endpoint: POST /groups/:id/uploads</code></pre>
*
* @param groupIdOrPath the group in the form of an Integer(ID), String(path), or Group instance, required
* @param inputStream the data to upload, required
* @param filename The filename of the file to upload
* @param mediaType unused; will be removed in the next major version
* @return a FileUpload instance with information on the just uploaded file
* @throws GitLabApiException if any exception occurs
*/
public FileUpload uploadFile(Object groupIdOrPath, InputStream inputStream, String filename, String mediaType)
throws GitLabApiException {
Response response = upload(
Response.Status.CREATED,
"file",
inputStream,
filename,
mediaType,
"groups",
getGroupIdOrPath(groupIdOrPath),
"uploads");
return (response.readEntity(FileUpload.class));
}
}