Class TagsApi

All Implemented Interfaces:
Constants

public class TagsApi extends AbstractApi
This class provides an entry point to all the GitLab Tags and Protected Tags API calls.
See Also:
  • Constructor Details

    • TagsApi

      public TagsApi(GitLabApi gitLabApi)
  • Method Details

    • getTags

      public List<Tag> getTags(Object projectIdOrPath) throws GitLabApiException
      Get a list of repository tags from a project, sorted by name in reverse alphabetical order.
      GitLab Endpoint: GET /projects/:id/repository/tags
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      Returns:
      the list of tags for the specified project ID
      Throws:
      GitLabApiException - if any exception occurs
    • getTags

      public List<Tag> getTags(Object projectIdOrPath, int page, int perPage) throws GitLabApiException
      Get a list of repository tags from a project, sorted by name in reverse alphabetical order and in the specified page range.
      GitLab Endpoint: GET /projects/:id/repository/tags
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      page - the page to get
      perPage - the number of Tag instances per page
      Returns:
      the list of tags for the specified project ID
      Throws:
      GitLabApiException - if any exception occurs
    • getTags

      public Pager<Tag> getTags(Object projectIdOrPath, int itemsPerPage) throws GitLabApiException
      Get a list of repository tags from a project, sorted by name in reverse alphabetical order.
      GitLab Endpoint: GET /projects/:id/repository/tags
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      itemsPerPage - the number of Project instances that will be fetched per page
      Returns:
      the Pager of tags for the specified project ID
      Throws:
      GitLabApiException - if any exception occurs
    • getTagsStream

      public Stream<Tag> getTagsStream(Object projectIdOrPath) throws GitLabApiException
      Get a Stream of repository tags from a project, sorted by name in reverse alphabetical order.
      GitLab Endpoint: GET /projects/:id/repository/tags
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      Returns:
      a Stream of tags for the specified project ID
      Throws:
      GitLabApiException - if any exception occurs
    • getTags

      public List<Tag> getTags(Object projectIdOrPath, Constants.TagOrderBy orderBy, Constants.SortOrder sortOrder, String search) throws GitLabApiException
      Get a list of repository tags from a project, sorted by name in reverse alphabetical order.
      GitLab Endpoint: GET /projects/:id/repository/tags
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      orderBy - return tags ordered by name or updated fields. Default is updated
      sortOrder - return tags sorted in asc or desc order. Default is desc
      search - return list of tags matching the search criteria
      Returns:
      the list of tags for the specified project ID
      Throws:
      GitLabApiException - if any exception occurs
      Since:
      GitLab 11.8
    • getTags

      public List<Tag> getTags(Object projectIdOrPath, Constants.TagOrderBy orderBy, Constants.SortOrder sortOrder, String search, int page, int perPage) throws GitLabApiException
      Get a list of repository tags from a project, sorted by name in reverse alphabetical order and in the specified page range.
      GitLab Endpoint: GET /projects/:id/repository/tags
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      orderBy - return tags ordered by name or updated fields. Default is updated
      sortOrder - return tags sorted in asc or desc order. Default is desc
      search - return list of tags matching the search criteria
      page - the page to get
      perPage - the number of Tag instances per page
      Returns:
      the list of tags for the specified project ID
      Throws:
      GitLabApiException - if any exception occurs
      Since:
      GitLab 11.8
    • getTags

      public Pager<Tag> getTags(Object projectIdOrPath, Constants.TagOrderBy orderBy, Constants.SortOrder sortOrder, String search, int itemsPerPage) throws GitLabApiException
      Get a list of repository tags from a project, sorted by name in reverse alphabetical order.
      GitLab Endpoint: GET /projects/:id/repository/tags
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      orderBy - return tags ordered by name or updated fields. Default is updated
      sortOrder - return tags sorted in asc or desc order. Default is desc
      search - return list of tags matching the search criteria
      itemsPerPage - the number of Project instances that will be fetched per page
      Returns:
      the Pager of tags for the specified project ID
      Throws:
      GitLabApiException - if any exception occurs
      Since:
      GitLab 11.8
    • getTagsStream

      public Stream<Tag> getTagsStream(Object projectIdOrPath, Constants.TagOrderBy orderBy, Constants.SortOrder sortOrder, String search) throws GitLabApiException
      Get a Stream of repository tags from a project, sorted by name in reverse alphabetical order.
      GitLab Endpoint: GET /projects/:id/repository/tags
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      orderBy - return tags ordered by name or updated fields. Default is updated
      sortOrder - return tags sorted in asc or desc order. Default is desc
      search - return list of tags matching the search criteria
      Returns:
      a Stream of tags for the specified project ID
      Throws:
      GitLabApiException - if any exception occurs
      Since:
      GitLab 11.8
    • getTag

      public Tag getTag(Object projectIdOrPath, String tagName) throws GitLabApiException
      Get a specific repository tag determined by its name.
      GitLab Endpoint: GET /projects/:id/repository/tags/:tagName
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      tagName - the name of the tag to fetch the info for
      Returns:
      a Tag instance with info on the specified tag
      Throws:
      GitLabApiException - if any exception occurs
    • getOptionalTag

      public Optional<Tag> getOptionalTag(Object projectIdOrPath, String tagName) throws GitLabApiException
      Get an Optional instance holding a Tag instance of a specific repository tag determined by its name.
      GitLab Endpoint: GET /projects/:id/repository/tags/:tagName
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      tagName - the name of the tag to fetch the info for
      Returns:
      an Optional instance with the specified project tag as the value
      Throws:
      GitLabApiException - if any exception occurs
    • createTag

      public Tag createTag(Object projectIdOrPath, String tagName, String ref) throws GitLabApiException
      Creates a tag on a particular ref of the given project.
      GitLab Endpoint: POST /projects/:id/repository/tags
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      tagName - The name of the tag Must be unique for the project
      ref - the git ref to place the tag on
      Returns:
      a Tag instance containing info on the newly created tag
      Throws:
      GitLabApiException - if any exception occurs
    • createTag

      public Tag createTag(Object projectIdOrPath, String tagName, String ref, String message, String releaseNotes) throws GitLabApiException
      Creates a tag on a particular ref of the given project with optional message and release notes.
      GitLab Endpoint: POST /projects/:id/repository/tags
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      tagName - The name of the tag Must be unique for the project
      ref - the git ref to place the tag on
      message - the message to included with the tag (optional)
      releaseNotes - the release notes for the tag (optional)
      Returns:
      a Tag instance containing info on the newly created tag
      Throws:
      GitLabApiException - if any exception occurs
    • createTag

      public Tag createTag(Object projectIdOrPath, String tagName, String ref, String message, File releaseNotesFile) throws GitLabApiException
      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 createTag(Object, String, String, String, String), but instead allows the release notes to be supplied in a file.
      GitLab Endpoint: POST /projects/:id/repository/tags
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      tagName - the name of the tag, must be unique for the project
      ref - the git ref to place the tag on
      message - the message to included with the tag (optional)
      releaseNotesFile - a whose contents are the release notes (optional)
      Returns:
      a Tag instance containing info on the newly created tag
      Throws:
      GitLabApiException - if any exception occurs
    • deleteTag

      public void deleteTag(Object projectIdOrPath, String tagName) throws GitLabApiException
      Deletes the tag from a project with the specified tag name.
      GitLab Endpoint: DELETE /projects/:id/repository/tags/:tag_name
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      tagName - The name of the tag to delete
      Throws:
      GitLabApiException - if any exception occurs
    • createRelease

      public Release createRelease(Object projectIdOrPath, String tagName, String releaseNotes) throws GitLabApiException
      Add release notes to the existing git tag.
      GitLab Endpoint: POST /projects/:id/repository/tags/:tagName/release
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      tagName - the name of a tag
      releaseNotes - release notes with markdown support
      Returns:
      a Tag instance containing info on the newly created tag
      Throws:
      GitLabApiException - if any exception occurs
    • updateRelease

      public Release updateRelease(Object projectIdOrPath, String tagName, String releaseNotes) throws GitLabApiException
      Updates the release notes of a given release.
      GitLab Endpoint: PUT /projects/:id/repository/tags/:tagName/release
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      tagName - the name of a tag
      releaseNotes - release notes with markdown support
      Returns:
      a Tag instance containing info on the newly created tag
      Throws:
      GitLabApiException - if any exception occurs
    • getProtectedTags

      public List<ProtectedTag> getProtectedTags(Object projectIdOrPath) throws GitLabApiException
      Gets a list of protected tags from a project.
      GitLab Endpoint: GET /projects/:id/protected_tags
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      Returns:
      a List of protected tags for the specified project ID
      Throws:
      GitLabApiException - if any exception occurs
    • getProtectedTags

      public List<ProtectedTag> getProtectedTags(Object projectIdOrPath, int page, int perPage) throws GitLabApiException
      Gets a list of protected tags from a project and in the specified page range.
      GitLab Endpoint: GET /projects/:id/protected_tags
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      page - the page to get
      perPage - the number of Tag instances per page
      Returns:
      a List of tags for the specified project ID and page range
      Throws:
      GitLabApiException - if any exception occurs
    • getProtectedTags

      public Pager<ProtectedTag> getProtectedTags(Object projectIdOrPath, int itemsPerPage) throws GitLabApiException
      Get a Pager of protected tags for a project.
      GitLab Endpoint: GET /projects/:id/protected_tags
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      itemsPerPage - the number of Project instances that will be fetched per page
      Returns:
      the Pager of protected tags for the specified project ID
      Throws:
      GitLabApiException - if any exception occurs
    • getProtectedTagsStream

      public Stream<ProtectedTag> getProtectedTagsStream(Object projectIdOrPath) throws GitLabApiException
      Get a Stream of protected tags for a project.
      GitLab Endpoint: GET /projects/:id/protected_tags/:name
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      Returns:
      a Stream of protected tags for the specified project ID
      Throws:
      GitLabApiException - if any exception occurs
    • getProtectedTag

      public ProtectedTag getProtectedTag(Object projectIdOrPath, String name) throws GitLabApiException
      Gets a single protected tag or wildcard protected tag
      GitLab Endpoint: GET /projects/:id/protected_tags/:name
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      name - the name of the tag or wildcard
      Returns:
      a ProtectedTag instance with info on the specified protected tag
      Throws:
      GitLabApiException - if any exception occurs
    • getOptionalProtectedTag

      public Optional<ProtectedTag> getOptionalProtectedTag(Object projectIdOrPath, String name) throws GitLabApiException
      Get an Optional instance holding a protected tag or wildcard protected tag.
      GitLab Endpoint: GET /projects/:id/protected_tags/:name
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      name - the name of the tag or wildcard
      Returns:
      an Optional instance with the specified protected tag as the value
      Throws:
      GitLabApiException - if any exception occurs
    • protectTag

      public ProtectedTag protectTag(Object projectIdOrPath, String name, AccessLevel createAccessLevel) throws GitLabApiException
      Protects a single repository tag or several project repository tags using a wildcard protected tag.
      GitLab Endpoint: GET /projects/:id/protected_tags
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      name - the name of the tag or wildcard
      createAccessLevel - the access level allowed to create
      Returns:
      a ProtectedTag instance
      Throws:
      GitLabApiException - if any exception occurs
    • unprotectTag

      public void unprotectTag(Object projectIdOrPath, String name) throws GitLabApiException
      Unprotects the given protected tag or wildcard protected tag.
      GitLab Endpoint: GET /projects/:id/protected_tags/:name
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      name - the name of the tag or wildcard
      Throws:
      GitLabApiException - if any exception occurs