Module bus.gitlab

Class TopicsApi

java.lang.Object
org.miaixz.bus.gitlab.AbstractApi
org.miaixz.bus.gitlab.TopicsApi
All Implemented Interfaces:
Constants

public class TopicsApi extends AbstractApi
  • Constructor Details

    • TopicsApi

      public TopicsApi(GitLabApi gitLabApi)
  • Method Details

    • getTopics

      public List<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 List<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<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 Stream<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 Topic getTopic(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 Optional<Topic> getOptionalTopic(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 Topic createTopic(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 Topic updateTopic(Integer id, 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 Topic updateTopicAvatar(Integer id, 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 Topic deleteTopicAvatar(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(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 Topic mergeTopics(Integer sourceTopicId, 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