Class WikisApi

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

    public class WikisApi
    extends AbstractApi
    This class implements the client side API for the GitLab Wikis API. See Wikis API at GitLab for more information.
    • 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.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.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
      WikisApi​(GitLabApi gitLabApi)  
    • Constructor Detail

      • WikisApi

        public WikisApi​(GitLabApi gitLabApi)
    • Method Detail

      • getPages

        public java.util.List<org.gitlab4j.api.models.WikiPage> getPages​(java.lang.Object projectIdOrPath)
                                                                  throws GitLabApiException
        Get a list of pages in project wiki.
        GitLab Endpoint: GET /projects/:id/wikis
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        Returns:
        a list of pages in the project's wiki
        Throws:
        GitLabApiException - if any exception occurs
      • getPages

        public Pager<org.gitlab4j.api.models.WikiPage> getPages​(java.lang.Object projectIdOrPath,
                                                                int itemsPerPage)
                                                         throws GitLabApiException
        Get a Pager of pages in project wiki.
        GitLab Endpoint: GET /projects/:id/wikis
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        itemsPerPage - the number of WikiPage instances that will be fetched per page
        Returns:
        a Pager of pages in project's wiki for the specified range
        Throws:
        GitLabApiException - if any exception occurs
      • getPagesStream

        public java.util.stream.Stream<org.gitlab4j.api.models.WikiPage> getPagesStream​(java.lang.Object projectIdOrPath)
                                                                                 throws GitLabApiException
        Get a Stream of pages in project wiki.
        GitLab Endpoint: GET /projects/:id/wikis
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        Returns:
        a Pager of pages in project's wiki for the specified range
        Throws:
        GitLabApiException - if any exception occurs
      • getPages

        public java.util.List<org.gitlab4j.api.models.WikiPage> getPages​(java.lang.Object projectIdOrPath,
                                                                         int page,
                                                                         int perPage)
                                                                  throws GitLabApiException
        Deprecated.
        Will be removed in a future release, use getPages(Object, Boolean, int)
        Get a list of pages in project wiki for the specified page.
        GitLab Endpoint: GET /projects/:id/wikis
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        page - the page to get
        perPage - the number of wiki-pages per page
        Returns:
        a list of pages in project's wiki for the specified range
        Throws:
        GitLabApiException - if any exception occurs
      • getPages

        public java.util.List<org.gitlab4j.api.models.WikiPage> getPages​(java.lang.Object projectIdOrPath,
                                                                         java.lang.Boolean withContent)
                                                                  throws GitLabApiException
        Get a List of pages in project wiki.
        GitLab Endpoint: GET /projects/:id/wikis
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        withContent - if true the results will include the pages content
        Returns:
        a List of pages in project's wiki for the specified range
        Throws:
        GitLabApiException - if any exception occurs
      • getPages

        public Pager<org.gitlab4j.api.models.WikiPage> getPages​(java.lang.Object projectIdOrPath,
                                                                java.lang.Boolean withContent,
                                                                int itemsPerPage)
                                                         throws GitLabApiException
        Get a Pager of pages in project wiki.
        GitLab Endpoint: GET /projects/:id/wikis
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        withContent - if true the results will include the pages content
        itemsPerPage - the number of WikiPage instances that will be fetched per page
        Returns:
        a Pager of pages in project's wiki for the specified range
        Throws:
        GitLabApiException - if any exception occurs
      • getPagesStream

        public java.util.stream.Stream<org.gitlab4j.api.models.WikiPage> getPagesStream​(java.lang.Object projectIdOrPath,
                                                                                        java.lang.Boolean withContent)
                                                                                 throws GitLabApiException
        Get a Stream of pages in project wiki.
        GitLab Endpoint: GET /projects/:id/wikis
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        withContent - if true the results will include the pages content
        Returns:
        a Stream of pages in project's wiki for the specified range
        Throws:
        GitLabApiException - if any exception occurs
      • getPage

        public org.gitlab4j.api.models.WikiPage getPage​(java.lang.Object projectIdOrPath,
                                                        java.lang.String slug)
                                                 throws GitLabApiException
        Get a single page of project wiki.
        GitLab Endpoint: GET /projects/:id/wikis/:slug
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        slug - the slug of the project's wiki page
        Returns:
        the specified project Snippet
        Throws:
        GitLabApiException - if any exception occurs
      • getOptionalPage

        public java.util.Optional<org.gitlab4j.api.models.WikiPage> getOptionalPage​(java.lang.Object projectIdOrPath,
                                                                                    java.lang.String slug)
        Get a single page of project wiki as an Optional instance.
        GitLab Endpoint: GET /projects/:id/wikis/:slug
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        slug - the slug of the project's wiki page
        Returns:
        the specified project Snippet as an Optional instance
      • createPage

        public org.gitlab4j.api.models.WikiPage createPage​(java.lang.Object projectIdOrPath,
                                                           java.lang.String title,
                                                           java.lang.String content)
                                                    throws GitLabApiException
        Creates a new project wiki page. The user must have permission to create new wiki page.
        GitLab Endpoint: POST /projects/:id/wikis
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        title - the title of a snippet, required
        content - the content of a wiki page, required
        Returns:
        a WikiPage instance with info on the created page
        Throws:
        GitLabApiException - if any exception occurs
      • updatePage

        public org.gitlab4j.api.models.WikiPage updatePage​(java.lang.Object projectIdOrPath,
                                                           java.lang.String slug,
                                                           java.lang.String title,
                                                           java.lang.String content)
                                                    throws GitLabApiException
        Updates an existing project wiki page. The user must have permission to change an existing wiki page.
        GitLab Endpoint: PUT /projects/:id/wikis/:slug
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        slug - the slug of the project's wiki page, required
        title - the title of a snippet, optional
        content - the content of a page, optional. Either title or content must be supplied.
        Returns:
        a WikiPage instance with info on the updated page
        Throws:
        GitLabApiException - if any exception occurs
      • deletePage

        public void deletePage​(java.lang.Object projectIdOrPath,
                               java.lang.String slug)
                        throws GitLabApiException
        Deletes an existing project wiki page. This is an idempotent function and deleting a non-existent page does not cause an error.
        GitLab Endpoint: DELETE /projects/:id/wikis/:slug
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        slug - the slug of the project's wiki page
        Throws:
        GitLabApiException - if any exception occurs
      • uploadAttachment

        public org.gitlab4j.api.models.WikiAttachment uploadAttachment​(java.lang.Object projectIdOrPath,
                                                                       java.io.File fileToUpload)
                                                                throws GitLabApiException
        Uploads a file to the attachment folder inside the wiki’s repository. The attachment folder is the uploads folder.
        POST /projects/:id/wikis/attachments
        Parameters:
        projectIdOrPath - projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required
        fileToUpload - the File instance of the file to upload, required
        Returns:
        a FileUpload instance with information on the just uploaded file
        Throws:
        GitLabApiException - if any exception occurs
      • uploadAttachment

        public org.gitlab4j.api.models.WikiAttachment uploadAttachment​(java.lang.Object projectIdOrPath,
                                                                       java.io.File fileToUpload,
                                                                       java.lang.String branch)
                                                                throws GitLabApiException
        Uploads a file to the attachment folder inside the wiki’s repository. The attachment folder is the uploads folder.
        POST /projects/:id/wikis/attachments
        Parameters:
        projectIdOrPath - projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required
        fileToUpload - the File instance of the file to upload, required
        branch - the name of the branch, defaults to the wiki repository default branch, optional
        Returns:
        a FileUpload instance with information on the just uploaded file
        Throws:
        GitLabApiException - if any exception occurs