Package org.gitlab4j.api
Class WikisApi
java.lang.Object
org.gitlab4j.api.AbstractApi
org.gitlab4j.api.WikisApi
- All Implemented Interfaces:
Constants
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.api.Constants
Constants.ActionType, Constants.ApplicationScope, Constants.ArchiveFormat, Constants.AutoDevopsDeployStrategy, Constants.BuildGitStrategy, Constants.CommitBuildState, Constants.ContributorOrderBy, Constants.DeploymentOrderBy, Constants.DeploymentStatus, Constants.DeployTokenScope, Constants.Encoding, Constants.EpicOrderBy, Constants.EventScope, Constants.GroupOrderBy, Constants.GroupSearchScope, Constants.ImpersonationState, Constants.IssueOrderBy, Constants.IssueScope, Constants.IssueState, Constants.JobScope, Constants.LineType, Constants.MergeRequestOrderBy, Constants.MergeRequestScope, Constants.MergeRequestSearchIn, Constants.MergeRequestState, Constants.MilestoneState, Constants.PackageOrderBy, Constants.PackageStatus, Constants.PipelineOrderBy, Constants.PipelineScope, Constants.ProjectOrderBy, Constants.ProjectSearchScope, Constants.SearchScope, Constants.SortOrder, Constants.SquashOption, Constants.StateEvent, Constants.TagOrderBy, Constants.TargetType, Constants.TodoAction, Constants.TodoState, Constants.TodoType, Constants.TokenType
-
Field Summary
Fields inherited from class org.gitlab4j.api.AbstractApi
gitLabApi
Fields inherited from interface org.gitlab4j.api.Constants
NEXT_PAGE_HEADER, PAGE_HEADER, PAGE_PARAM, PER_PAGE, PER_PAGE_PARAM, PREV_PAGE_HEADER, TOTAL_HEADER, TOTAL_PAGES_HEADER
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreatePage
(Object projectIdOrPath, String title, String content) Creates a new project wiki page.void
deletePage
(Object projectIdOrPath, String slug) Deletes an existing project wiki page.getOptionalPage
(Object projectIdOrPath, String slug) Get a single page of project wiki as an Optional instance.Get a single page of project wiki.Get a list of pages in project wiki.Get a List of pages in project wiki.Get a Pager of pages in project wiki.Get a Pager of pages in project wiki.Deprecated.getPagesStream
(Object projectIdOrPath) Get a Stream of pages in project wiki.getPagesStream
(Object projectIdOrPath, boolean withContent) Get a Stream of pages in project wiki.updatePage
(Object projectIdOrPath, String slug, String title, String content) Updates an existing project wiki page.uploadAttachment
(Object projectIdOrPath, File fileToUpload) Uploads a file to the attachment folder inside the wiki’s repository.uploadAttachment
(Object projectIdOrPath, File fileToUpload, String branch) Uploads a file to the attachment folder inside the wiki’s repository.Methods inherited from class org.gitlab4j.api.AbstractApi
addFormParam, addFormParam, delete, delete, get, get, getApiClient, getApiVersion, getDefaultPerPage, getDefaultPerPageParam, getDefaultPerPageParam, getGroupIdOrPath, getLabelIdOrName, getPageQueryParams, getPageQueryParams, getPerPageQueryParam, getProjectIdOrPath, getUserIdOrUsername, getWithAccepts, handle, head, isApiVersion, patch, patch, post, post, post, post, post, put, put, put, putUpload, putUpload, putWithFormData, upload, upload, upload, upload, urlEncode, validate
-
Constructor Details
-
WikisApi
-
-
Method Details
-
getPages
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
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 instanceitemsPerPage
- 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
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 List<WikiPage> getPages(Object projectIdOrPath, int page, int perPage) throws GitLabApiException Deprecated.Will be removed in a future release, usegetPages(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 instancepage
- the page to getperPage
- 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 List<WikiPage> getPages(Object projectIdOrPath, 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 instancewithContent
- 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<WikiPage> getPages(Object projectIdOrPath, 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 instancewithContent
- if true the results will include the pages contentitemsPerPage
- 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 Stream<WikiPage> getPagesStream(Object projectIdOrPath, 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 instancewithContent
- 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
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 instanceslug
- the slug of the project's wiki page- Returns:
- the specified project Snippet
- Throws:
GitLabApiException
- if any exception occurs
-
getOptionalPage
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 instanceslug
- the slug of the project's wiki page- Returns:
- the specified project Snippet as an Optional instance
-
createPage
public WikiPage createPage(Object projectIdOrPath, String title, 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 instancetitle
- the title of a snippet, requiredcontent
- 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 WikiPage updatePage(Object projectIdOrPath, String slug, String title, 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 instanceslug
- the slug of the project's wiki page, requiredtitle
- the title of a snippet, optionalcontent
- 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
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 instanceslug
- the slug of the project's wiki page- Throws:
GitLabApiException
- if any exception occurs
-
uploadAttachment
public WikiAttachment uploadAttachment(Object projectIdOrPath, 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, requiredfileToUpload
- 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 WikiAttachment uploadAttachment(Object projectIdOrPath, File fileToUpload, 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, requiredfileToUpload
- the File instance of the file to upload, requiredbranch
- 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
-
getPages(Object, boolean, int)