Package org.gitlab4j.api
Class WikisApi
- java.lang.Object
-
- org.gitlab4j.api.AbstractApi
-
- org.gitlab4j.api.WikisApi
-
- All Implemented Interfaces:
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.api.Constants
Constants.ActionType, Constants.ApplicationScope, Constants.ArchiveFormat, Constants.CommitBuildState, Constants.Encoding, Constants.EpicOrderBy, Constants.GroupOrderBy, Constants.ImpersonationState, Constants.IssueOrderBy, Constants.IssueScope, Constants.IssueState, Constants.JobScope, Constants.LineType, Constants.MergeRequestOrderBy, Constants.MergeRequestScope, Constants.MergeRequestState, Constants.MilestoneState, Constants.PipelineOrderBy, Constants.PipelineScope, Constants.ProjectOrderBy, Constants.SortOrder, Constants.StateEvent, Constants.TargetType, Constants.TokenType
-
-
Field Summary
-
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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WikiPage
createPage(Object projectIdOrPath, String title, String content)
Creates a new project wiki page.void
deletePage(Object projectIdOrPath, String slug)
Deletes an existing project wiki page.Optional<WikiPage>
getOptionalPage(Object projectIdOrPath, String slug)
Get a single page of project wiki as an Optional instance.WikiPage
getPage(Object projectIdOrPath, String slug)
Get a single page of project wiki.List<WikiPage>
getPages(Object projectIdOrPath)
Get a list of pages in project wiki.List<WikiPage>
getPages(Object projectIdOrPath, int page, int perPage)
Get a list of pages in project wiki for the specified page.WikiPage
updatePage(Object projectIdOrPath, String slug, String title, String content)
Updates an existing project wiki page.WikiAttachment
uploadAttachment(Object projectIdOrPath, File fileToUpload)
Uploads a file to the attachment folder inside the wiki’s repository.WikiAttachment
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, getPageQueryParams, getPageQueryParams, getPerPageQueryParam, getProjectIdOrPath, getUserIdOrUsername, getWithAccepts, handle, head, isApiVersion, post, post, post, post, post, put, put, putUpload, putUpload, putWithFormData, upload, upload, upload, urlEncode, validate
-
-
-
-
Constructor Detail
-
WikisApi
public WikisApi(GitLabApi gitLabApi)
-
-
Method Detail
-
getPages
public List<WikiPage> getPages(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 Integer(ID), String(path), or Project instance- Returns:
- a list of pages in the project's wiki
- Throws:
GitLabApiException
- if any exception occurs
-
getPages
public List<WikiPage> getPages(Object projectIdOrPath, int page, int perPage) throws GitLabApiException
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 Integer(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
-
getPage
public WikiPage getPage(Object projectIdOrPath, 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 Integer(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
public Optional<WikiPage> getOptionalPage(Object projectIdOrPath, 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 Integer(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 Integer(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 Integer(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
public void deletePage(Object projectIdOrPath, 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 Integer(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 Integer(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 Integer(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
-
-