Class TopicsApi

  • All Implemented Interfaces:
    org.gitlab4j.models.Constants

    public class TopicsApi
    extends AbstractApi
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.gitlab4j.models.Constants

        org.gitlab4j.models.Constants.ActionType, org.gitlab4j.models.Constants.ApplicationScope, org.gitlab4j.models.Constants.ArchiveFormat, org.gitlab4j.models.Constants.AutoCancelPendingPipelines, org.gitlab4j.models.Constants.AutoDevopsDeployStrategy, org.gitlab4j.models.Constants.BuildGitStrategy, org.gitlab4j.models.Constants.CommitBuildState, org.gitlab4j.models.Constants.ContributorOrderBy, org.gitlab4j.models.Constants.DefaultBranchProtectionLevel, org.gitlab4j.models.Constants.DeploymentOrderBy, org.gitlab4j.models.Constants.DeploymentStatus, org.gitlab4j.models.Constants.DeployTokenScope, org.gitlab4j.models.Constants.Encoding, org.gitlab4j.models.Constants.EpicOrderBy, org.gitlab4j.models.Constants.EventScope, org.gitlab4j.models.Constants.GroupOrderBy, org.gitlab4j.models.Constants.GroupSearchScope<T extends java.lang.Object>, org.gitlab4j.models.Constants.ImpersonationState, org.gitlab4j.models.Constants.IssueOrderBy, org.gitlab4j.models.Constants.IssueScope, org.gitlab4j.models.Constants.IssueState, org.gitlab4j.models.Constants.JobScope, org.gitlab4j.models.Constants.LineType, org.gitlab4j.models.Constants.MergeRequestOrderBy, org.gitlab4j.models.Constants.MergeRequestScope, org.gitlab4j.models.Constants.MergeRequestSearchIn, org.gitlab4j.models.Constants.MergeRequestState, org.gitlab4j.models.Constants.MilestoneState, org.gitlab4j.models.Constants.PackageOrderBy, org.gitlab4j.models.Constants.PackageStatus, org.gitlab4j.models.Constants.PipelineOrderBy, org.gitlab4j.models.Constants.PipelineScope, org.gitlab4j.models.Constants.PipelineSource, org.gitlab4j.models.Constants.ProjectAccessTokenScope, org.gitlab4j.models.Constants.ProjectCreationLevel, org.gitlab4j.models.Constants.ProjectFeatureVisibilityAccessLevel, org.gitlab4j.models.Constants.ProjectOrderBy, org.gitlab4j.models.Constants.ProjectSearchScope<T extends java.lang.Object>, org.gitlab4j.models.Constants.SearchScope<T extends java.lang.Object>, org.gitlab4j.models.Constants.SortOrder, org.gitlab4j.models.Constants.SquashOption, org.gitlab4j.models.Constants.StateEvent, org.gitlab4j.models.Constants.SubgroupCreationLevel, org.gitlab4j.models.Constants.TagOrderBy, org.gitlab4j.models.Constants.TargetType, org.gitlab4j.models.Constants.TodoAction, org.gitlab4j.models.Constants.TodoState, org.gitlab4j.models.Constants.TodoType, org.gitlab4j.models.Constants.TokenType
    • Field Summary

      • Fields inherited from interface org.gitlab4j.models.Constants

        NEXT_PAGE_HEADER, PAGE_HEADER, PAGE_PARAM, PER_PAGE, PER_PAGE_PARAM, PREV_PAGE_HEADER, TOTAL_HEADER, TOTAL_PAGES_HEADER
    • Constructor Summary

      Constructors 
      Constructor Description
      TopicsApi​(GitLabApi gitLabApi)  
    • Constructor Detail

      • TopicsApi

        public TopicsApi​(GitLabApi gitLabApi)
    • Method Detail

      • getTopics

        public java.util.List<org.gitlab4j.api.models.Topic> getTopics()
                                                                throws GitLabApiException

        Get a list of Topics.

        WARNING: Do not use this method to fetch Topics from https://gitlab.com, gitlab.com has many 1,000's of public topics and it will a long time to fetch all of them. Instead use getTopics(int itemsPerPage) which will return a Pager of Topic instances.
        GitLab Endpoint: GET /topics
        Returns:
        the list of topics viewable by the authenticated user
        Throws:
        GitLabApiException - if any exception occurs
      • getTopics

        public java.util.List<org.gitlab4j.api.models.Topic> getTopics​(int page,
                                                                       int perPage)
                                                                throws GitLabApiException
        Get a list of topics in the specified page range.
        GitLab Endpoint: GET /topics
        Parameters:
        page - the page to get
        perPage - the number of Topic instances per page
        Returns:
        the list of topics
        Throws:
        GitLabApiException - if any exception occurs
      • getTopics

        public Pager<org.gitlab4j.api.models.Topic> getTopics​(int itemsPerPage)
                                                       throws GitLabApiException
        Get a Pager of topics.
        GitLab Endpoint: GET /topics
        Parameters:
        itemsPerPage - the number of Topic instances that will be fetched per page
        Returns:
        the pager of topics
        Throws:
        GitLabApiException - if any exception occurs
      • getTopicsStream

        public java.util.stream.Stream<org.gitlab4j.api.models.Topic> getTopicsStream()
                                                                               throws GitLabApiException
        Get a Stream of topics.
        GitLab Endpoint: GET /topics
        Returns:
        the stream of topics
        Throws:
        GitLabApiException - if any exception occurs
      • getTopic

        public org.gitlab4j.api.models.Topic getTopic​(java.lang.Integer id)
                                               throws GitLabApiException
        Get all details of a topic.
        GitLab Endpoint: GET /topics/:id
        Parameters:
        id - the topic ID
        Returns:
        the topic for the specified topic id
        Throws:
        GitLabApiException - if any exception occurs
      • getOptionalTopic

        public java.util.Optional<org.gitlab4j.api.models.Topic> getOptionalTopic​(java.lang.Integer id)
        Get all details of a topic as an Optional instance.
        GitLab Endpoint: GET /topics/:id
        Parameters:
        id - the topic ID
        Returns:
        the Topic for the specified topic id as an Optional instance
      • createTopic

        public org.gitlab4j.api.models.Topic createTopic​(org.gitlab4j.api.models.TopicParams params)
                                                  throws GitLabApiException
        Creates a new Topic. Available only for users who can create topics.
        GitLab Endpoint: POST /topics
        Parameters:
        params - a TopicParams instance holding the parameters for the topic creation
        Returns:
        the created Topic instance
        Throws:
        GitLabApiException - if any exception occurs
      • updateTopic

        public org.gitlab4j.api.models.Topic updateTopic​(java.lang.Integer id,
                                                         org.gitlab4j.api.models.TopicParams params)
                                                  throws GitLabApiException
        Update a project topic.
        GitLab Endpoint: PUT /topics/:id
        Parameters:
        id - the topic id
        params - a TopicParams instance holding the properties to Update
        Returns:
        the updated Topic instance
        Throws:
        GitLabApiException - at any exception
      • updateTopicAvatar

        public org.gitlab4j.api.models.Topic updateTopicAvatar​(java.lang.Integer id,
                                                               java.io.File avatarFile)
                                                        throws GitLabApiException
        Uploads and sets the topic's avatar for the specified topic.
        GitLab Endpoint: PUT /topics/:id
        Parameters:
        id - the topic in the form of an Integer
        avatarFile - the File instance of the avatar file to upload
        Returns:
        the updated Topic instance
        Throws:
        GitLabApiException - if any exception occurs
      • deleteTopicAvatar

        public org.gitlab4j.api.models.Topic deleteTopicAvatar​(java.lang.Integer id)
                                                        throws GitLabApiException
        Delete the topic's avatar for the specified topic.
        GitLab Endpoint: PUT /topics/:id
        Parameters:
        id - the topic in the form of an Integer
        Returns:
        the updated Topic instance
        Throws:
        GitLabApiException - if any exception occurs
      • deleteTopic

        public void deleteTopic​(java.lang.Integer id)
                         throws GitLabApiException
        Delete a topic. You must be an administrator to delete a project topic. When you delete a project topic, you also delete the topic assignment for projects.
        GitLab Endpoint: DELETE /topics/:id
        Parameters:
        id - the topic to deleted in the form of an Integer
        Throws:
        GitLabApiException - if any exception occurs
      • mergeTopics

        public org.gitlab4j.api.models.Topic mergeTopics​(java.lang.Integer sourceTopicId,
                                                         java.lang.Integer targetTopicId)
                                                  throws GitLabApiException
        Merge two topics together. You must be an administrator to merge a source topic into a target topic. When you merge topics, you delete the source topic and move all assigned projects to the target topic.
        GitLab Endpoint: POST /topics/merge
        Parameters:
        sourceTopicId - ID of source project topic
        targetTopicId - ID of target project topic
        Returns:
        the merged Topic instance
        Throws:
        GitLabApiException - if any exception occurs