public class SnippetsApi extends AbstractApi
Constants.ActionType, Constants.ApplicationScope, Constants.ArchiveFormat, Constants.CommitBuildState, Constants.Encoding, Constants.EpicOrderBy, 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.PipelineOrderBy, Constants.PipelineScope, Constants.ProjectOrderBy, Constants.ProjectSearchScope, Constants.SearchScope, Constants.SortOrder, Constants.StateEvent, Constants.TagOrderBy, Constants.TargetType, Constants.TodoAction, Constants.TodoState, Constants.TodoType, Constants.TokenType
gitLabApi
NEXT_PAGE_HEADER, PAGE_HEADER, PAGE_PARAM, PER_PAGE, PER_PAGE_PARAM, PREV_PAGE_HEADER, TOTAL_HEADER, TOTAL_PAGES_HEADER
Constructor and Description |
---|
SnippetsApi(GitLabApi gitLabApi) |
Modifier and Type | Method and Description |
---|---|
Snippet |
createSnippet(String title,
String fileName,
String content)
Create a new Snippet.
|
Snippet |
createSnippet(String title,
String fileName,
String content,
Visibility visibility,
String description)
Create a new Snippet.
|
void |
deleteSnippet(Integer snippetId)
Removes Snippet.
|
Optional<Snippet> |
getOptionalSnippet(Integer snippetId)
Get a specific snippet as an Optional instance.
|
Optional<Snippet> |
getOptionalSnippet(Integer snippetId,
boolean downloadContent)
Get a specific snippet as an Optional instance.
|
Snippet |
getSnippet(Integer snippetId)
Get a specific Snippet.
|
Snippet |
getSnippet(Integer snippetId,
boolean downloadContent)
Get a specific Snippet.
|
String |
getSnippetContent(Integer snippetId)
Get the content of a Snippet.
|
List<Snippet> |
getSnippets()
Get a list of the authenticated user's snippets.
|
List<Snippet> |
getSnippets(boolean downloadContent)
Get a list of the authenticated user's snippets.
|
Pager<Snippet> |
getSnippets(int itemsPerPage)
Get a Pager of the authenticated user's snippets.
|
Stream<Snippet> |
getSnippetsStream()
Get a Stream of the authenticated user's snippets.
|
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
public SnippetsApi(GitLabApi gitLabApi)
public List<Snippet> getSnippets(boolean downloadContent) throws GitLabApiException
GitLab Endpoint: GET /snippets
downloadContent
- indicating whether to download the snippet contentGitLabApiException
- if any exception occurspublic List<Snippet> getSnippets() throws GitLabApiException
GitLab Endpoint: GET /snippets
GitLabApiException
- if any exception occurspublic Pager<Snippet> getSnippets(int itemsPerPage) throws GitLabApiException
GitLab Endpoint: GET /snippets
itemsPerPage
- the number of snippets per pageGitLabApiException
- if any exception occurspublic Stream<Snippet> getSnippetsStream() throws GitLabApiException
GitLab Endpoint: GET /snippets
GitLabApiException
- if any exception occurspublic String getSnippetContent(Integer snippetId) throws GitLabApiException
GitLab Endpoint: GET /snippets/:id/raw
snippetId
- the snippet ID to removeGitLabApiException
- if any exception occurspublic Snippet getSnippet(Integer snippetId, boolean downloadContent) throws GitLabApiException
snippetId
- the snippet ID to getdownloadContent
- indicating whether to download the snippet contentGitLabApiException
- if any exception occurspublic Snippet getSnippet(Integer snippetId) throws GitLabApiException
snippetId
- the snippet ID to getGitLabApiException
- if any exception occurspublic Optional<Snippet> getOptionalSnippet(Integer snippetId)
GitLab Endpoint: GET /snippets/:snippet_id
snippetId
- the ID of the snippet to get the Optional instance forpublic Optional<Snippet> getOptionalSnippet(Integer snippetId, boolean downloadContent)
GitLab Endpoint: GET /snippets/:snippet_id
snippetId
- the ID of the snippet to get the Optional instance fordownloadContent
- indicating whether to download the snippet contentpublic Snippet createSnippet(String title, String fileName, String content) throws GitLabApiException
title
- the title of the snippetfileName
- the file name of the snippetcontent
- the content of the snippetGitLabApiException
- if any exception occurspublic Snippet createSnippet(String title, String fileName, String content, Visibility visibility, String description) throws GitLabApiException
title
- the title of the snippetfileName
- the file name of the snippetcontent
- the content of the snippetvisibility
- the visibility (Public, Internal, Private) of the snippetdescription
- the description of the snippetGitLabApiException
- if any exception occurspublic void deleteSnippet(Integer snippetId) throws GitLabApiException
GitLab Endpoint: DELETE /snippets/:id
snippetId
- the snippet ID to removeGitLabApiException
- if any exception occursCopyright © 2019. All rights reserved.