Commit 4b18991b authored by Greg Messner's avatar Greg Messner
Browse files

Added deprecated tags to all calls replaced by the TagsApi.

No related merge requests found
Showing with 19 additions and 49 deletions
+19 -49
package org.gitlab4j.api; package org.gitlab4j.api;
import org.gitlab4j.api.GitLabApi.ApiVersion;
import org.gitlab4j.api.models.Branch;
import org.gitlab4j.api.models.CompareResults;
import org.gitlab4j.api.models.Contributor;
import org.gitlab4j.api.models.Release;
import org.gitlab4j.api.models.Tag;
import org.gitlab4j.api.models.TreeItem;
import org.gitlab4j.api.utils.FileUtils;
import javax.ws.rs.core.Form;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
...@@ -22,6 +9,19 @@ import java.nio.file.Files; ...@@ -22,6 +9,19 @@ import java.nio.file.Files;
import java.nio.file.StandardCopyOption; import java.nio.file.StandardCopyOption;
import java.util.List; import java.util.List;
import javax.ws.rs.core.Form;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.gitlab4j.api.GitLabApi.ApiVersion;
import org.gitlab4j.api.models.Branch;
import org.gitlab4j.api.models.CompareResults;
import org.gitlab4j.api.models.Contributor;
import org.gitlab4j.api.models.Tag;
import org.gitlab4j.api.models.TreeItem;
import org.gitlab4j.api.utils.FileUtils;
/** /**
* This class provides an entry point to all the GitLab API repository calls. * This class provides an entry point to all the GitLab API repository calls.
*/ */
...@@ -165,6 +165,7 @@ public class RepositoryApi extends AbstractApi { ...@@ -165,6 +165,7 @@ public class RepositoryApi extends AbstractApi {
* @param projectId the ID of the project to get the tags for * @param projectId the ID of the project to get the tags for
* @return the list of tags for the specified project ID * @return the list of tags for the specified project ID
* @throws GitLabApiException if any exception occurs * @throws GitLabApiException if any exception occurs
* @deprecated Replaced by TagsApi.getTags(Object)
*/ */
public List<Tag> getTags(Integer projectId) throws GitLabApiException { public List<Tag> getTags(Integer projectId) throws GitLabApiException {
Response response = get(Response.Status.OK, getDefaultPerPageParam(), "projects", projectId, "repository", "tags"); Response response = get(Response.Status.OK, getDefaultPerPageParam(), "projects", projectId, "repository", "tags");
...@@ -181,6 +182,7 @@ public class RepositoryApi extends AbstractApi { ...@@ -181,6 +182,7 @@ public class RepositoryApi extends AbstractApi {
* @param perPage the number of Tag instances per page * @param perPage the number of Tag instances per page
* @return the list of tags for the specified project ID * @return the list of tags for the specified project ID
* @throws GitLabApiException if any exception occurs * @throws GitLabApiException if any exception occurs
* @deprecated Replaced by TagsApi.getTags(Object, int, int)
*/ */
public List<Tag> getTags(Integer projectId, int page, int perPage) throws GitLabApiException { public List<Tag> getTags(Integer projectId, int page, int perPage) throws GitLabApiException {
Response response = get(Response.Status.OK, getPageQueryParams(page, perPage), "projects", projectId, "repository", "tags"); Response response = get(Response.Status.OK, getPageQueryParams(page, perPage), "projects", projectId, "repository", "tags");
...@@ -196,6 +198,7 @@ public class RepositoryApi extends AbstractApi { ...@@ -196,6 +198,7 @@ public class RepositoryApi extends AbstractApi {
* @param itemsPerPage the number of Project instances that will be fetched per page * @param itemsPerPage the number of Project instances that will be fetched per page
* @return the list of tags for the specified project ID * @return the list of tags for the specified project ID
* @throws GitLabApiException if any exception occurs * @throws GitLabApiException if any exception occurs
* @deprecated Replaced by TagsApi.getTags(Object, int)
*/ */
public Pager<Tag> getTags(Integer projectId, int itemsPerPage) throws GitLabApiException { public Pager<Tag> getTags(Integer projectId, int itemsPerPage) throws GitLabApiException {
return (new Pager<Tag>(this, Tag.class, itemsPerPage, null, "projects", projectId, "repository", "tags")); return (new Pager<Tag>(this, Tag.class, itemsPerPage, null, "projects", projectId, "repository", "tags"));
...@@ -213,6 +216,7 @@ public class RepositoryApi extends AbstractApi { ...@@ -213,6 +216,7 @@ public class RepositoryApi extends AbstractApi {
* @param releaseNotes the release notes for the tag (optional) * @param releaseNotes the release notes for the tag (optional)
* @return a Tag instance containing info on the newly created tag * @return a Tag instance containing info on the newly created tag
* @throws GitLabApiException if any exception occurs * @throws GitLabApiException if any exception occurs
* @deprecated Replaced by TagsApi.createTag(Object, String, String, String, String)
*/ */
public Tag createTag(Integer projectId, String tagName, String ref, String message, String releaseNotes) throws GitLabApiException { public Tag createTag(Integer projectId, String tagName, String ref, String message, String releaseNotes) throws GitLabApiException {
...@@ -225,42 +229,6 @@ public class RepositoryApi extends AbstractApi { ...@@ -225,42 +229,6 @@ public class RepositoryApi extends AbstractApi {
return (response.readEntity(Tag.class)); return (response.readEntity(Tag.class));
} }
/**
* Add release notes to the existing git tag.
*
* POST /projects/:id/repository/tags/:tagName/release
*
* @param projectId the ID of the project
* @param tagName the name of a tag
* @param releaseNotes release notes with markdown support
* @return a Tag instance containing info on the newly created tag
* @throws GitLabApiException if any exception occurs
*/
public Release createRelease(Integer projectId, String tagName, String releaseNotes) throws GitLabApiException {
Form formData = new GitLabApiForm()
.withParam("description", releaseNotes, false);
Response response = post(Response.Status.CREATED, formData.asMap(), "projects", projectId, "repository", "tags", tagName, "release");
return (response.readEntity(Release.class));
}
/**
* Updates the release notes of a given release.
*
* PUT /projects/:id/repository/tags/:tagName/release
*
* @param projectId the ID of the project
* @param tagName the name of a tag
* @param releaseNotes release notes with markdown support
* @return a Tag instance containing info on the newly created tag
* @throws GitLabApiException if any exception occurs
*/
public Release updateRelease(Integer projectId, String tagName, String releaseNotes) throws GitLabApiException {
Form formData = new GitLabApiForm()
.withParam("description", releaseNotes, false);
Response response = put(Response.Status.CREATED, formData.asMap(), "projects", projectId, "repository", "tags", tagName, "release");
return (response.readEntity(Release.class));
}
/** /**
* Creates a tag on a particular ref of a given project. A message and a File instance containing the * Creates a tag on a particular ref of a given project. A message and a File instance containing the
* release notes are optional. This method is the same as {@link #createTag(Integer, String, String, String, String)}, * release notes are optional. This method is the same as {@link #createTag(Integer, String, String, String, String)},
...@@ -275,6 +243,7 @@ public class RepositoryApi extends AbstractApi { ...@@ -275,6 +243,7 @@ public class RepositoryApi extends AbstractApi {
* @param releaseNotesFile a whose contents are the release notes (optional) * @param releaseNotesFile a whose contents are the release notes (optional)
* @return a Tag instance containing info on the newly created tag * @return a Tag instance containing info on the newly created tag
* @throws GitLabApiException if any exception occurs * @throws GitLabApiException if any exception occurs
* @deprecated Replaced by TagsApi.CreateTag(Object, String, String, String, File)
*/ */
public Tag createTag(Integer projectId, String tagName, String ref, String message, File releaseNotesFile) throws GitLabApiException { public Tag createTag(Integer projectId, String tagName, String ref, String message, File releaseNotesFile) throws GitLabApiException {
...@@ -300,6 +269,7 @@ public class RepositoryApi extends AbstractApi { ...@@ -300,6 +269,7 @@ public class RepositoryApi extends AbstractApi {
* @param projectId the ID of the project * @param projectId the ID of the project
* @param tagName The name of the tag to delete * @param tagName The name of the tag to delete
* @throws GitLabApiException if any exception occurs * @throws GitLabApiException if any exception occurs
* @deprecated Replaced by TagsApi.deleteTag(Object, String)
*/ */
public void deleteTag(Integer projectId, String tagName) throws GitLabApiException { public void deleteTag(Integer projectId, String tagName) throws GitLabApiException {
Response.Status expectedStatus = (isApiVersion(ApiVersion.V3) ? Response.Status.OK : Response.Status.NO_CONTENT); Response.Status expectedStatus = (isApiVersion(ApiVersion.V3) ? Response.Status.OK : Response.Status.NO_CONTENT);
......
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