Package org.gitlab4j.api
Class SnippetsApi
- java.lang.Object
-
- org.gitlab4j.api.AbstractApi
-
- org.gitlab4j.api.SnippetsApi
-
- All Implemented Interfaces:
org.gitlab4j.models.Constants
public class SnippetsApi extends AbstractApi
This class provides an entry point to all the GitLab Snippets API project calls.
-
-
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.AutoCancelPendingPipelines, 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.ProjectFeatureVisibilityAccessLevel, 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 class org.gitlab4j.api.AbstractApi
gitLabApi
-
-
Constructor Summary
Constructors Constructor Description SnippetsApi(GitLabApi gitLabApi)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.gitlab4j.api.models.Snippet
createSnippet(java.lang.String title, java.lang.String fileName, java.lang.String content)
Create a new Snippet.org.gitlab4j.api.models.Snippet
createSnippet(java.lang.String title, java.lang.String fileName, java.lang.String content, org.gitlab4j.api.models.Visibility visibility, java.lang.String description)
Create a new Snippet.void
deleteSnippet(java.lang.Long snippetId)
Removes Snippet.java.util.Optional<org.gitlab4j.api.models.Snippet>
getOptionalSnippet(java.lang.Long snippetId)
Get a specific snippet as an Optional instance.java.util.Optional<org.gitlab4j.api.models.Snippet>
getOptionalSnippet(java.lang.Long snippetId, boolean downloadContent)
Get a specific snippet as an Optional instance.org.gitlab4j.api.models.Snippet
getSnippet(java.lang.Long snippetId)
Get a specific Snippet.org.gitlab4j.api.models.Snippet
getSnippet(java.lang.Long snippetId, boolean downloadContent)
Get a specific Snippet.java.lang.String
getSnippetContent(java.lang.Long snippetId)
Get the content of a Snippet.java.util.List<org.gitlab4j.api.models.Snippet>
getSnippets()
Get a list of the authenticated user's snippets.java.util.List<org.gitlab4j.api.models.Snippet>
getSnippets(boolean downloadContent)
Get a list of the authenticated user's snippets.Pager<org.gitlab4j.api.models.Snippet>
getSnippets(int itemsPerPage)
Get a Pager of the authenticated user's snippets.java.util.stream.Stream<org.gitlab4j.api.models.Snippet>
getSnippetsStream()
Get a Stream of the authenticated user's snippets.-
Methods inherited from class org.gitlab4j.api.AbstractApi
addFormParam, addFormParam, delete, delete, get, get, getApiClient, getApiVersion, getDefaultPerPage, getDefaultPerPageParam, getDefaultPerPageParam, getGroupIdOrPath, getLabelIdOrName, getNamespaceIdOrPath, getPageQueryParams, getPageQueryParams, getPerPageQueryParam, getProjectIdOrPath, getUserIdOrUsername, getWithAccepts, handle, head, isApiVersion, patch, patch, post, post, post, post, post, put, put, put, putUpload, putUpload, putWithFormData, putWithFormData, upload, upload, upload, upload, urlEncode, validate
-
-
-
-
Constructor Detail
-
SnippetsApi
public SnippetsApi(GitLabApi gitLabApi)
-
-
Method Detail
-
getSnippets
public java.util.List<org.gitlab4j.api.models.Snippet> getSnippets(boolean downloadContent) throws GitLabApiException
Get a list of the authenticated user's snippets.GitLab Endpoint: GET /snippets
- Parameters:
downloadContent
- indicating whether to download the snippet content- Returns:
- a list of authenticated user's snippets
- Throws:
GitLabApiException
- if any exception occurs
-
getSnippets
public java.util.List<org.gitlab4j.api.models.Snippet> getSnippets() throws GitLabApiException
Get a list of the authenticated user's snippets.GitLab Endpoint: GET /snippets
- Returns:
- a list of authenticated user's snippets
- Throws:
GitLabApiException
- if any exception occurs
-
getSnippets
public Pager<org.gitlab4j.api.models.Snippet> getSnippets(int itemsPerPage) throws GitLabApiException
Get a Pager of the authenticated user's snippets.GitLab Endpoint: GET /snippets
- Parameters:
itemsPerPage
- the number of snippets per page- Returns:
- the Pager of snippets
- Throws:
GitLabApiException
- if any exception occurs
-
getSnippetsStream
public java.util.stream.Stream<org.gitlab4j.api.models.Snippet> getSnippetsStream() throws GitLabApiException
Get a Stream of the authenticated user's snippets.GitLab Endpoint: GET /snippets
- Returns:
- a Stream of authenticated user's snippets
- Throws:
GitLabApiException
- if any exception occurs
-
getSnippetContent
public java.lang.String getSnippetContent(java.lang.Long snippetId) throws GitLabApiException
Get the content of a Snippet.GitLab Endpoint: GET /snippets/:id/raw
- Parameters:
snippetId
- the snippet ID to remove- Returns:
- the content of snippet
- Throws:
GitLabApiException
- if any exception occurs
-
getSnippet
public org.gitlab4j.api.models.Snippet getSnippet(java.lang.Long snippetId, boolean downloadContent) throws GitLabApiException
Get a specific Snippet.- Parameters:
snippetId
- the snippet ID to getdownloadContent
- indicating whether to download the snippet content- Returns:
- the snippet with the given id
- Throws:
GitLabApiException
- if any exception occurs
-
getSnippet
public org.gitlab4j.api.models.Snippet getSnippet(java.lang.Long snippetId) throws GitLabApiException
Get a specific Snippet.- Parameters:
snippetId
- the snippet ID to get- Returns:
- the snippet with the given id
- Throws:
GitLabApiException
- if any exception occurs
-
getOptionalSnippet
public java.util.Optional<org.gitlab4j.api.models.Snippet> getOptionalSnippet(java.lang.Long snippetId)
Get a specific snippet as an Optional instance.GitLab Endpoint: GET /snippets/:snippet_id
- Parameters:
snippetId
- the ID of the snippet to get the Optional instance for- Returns:
- the specified Snippet as an Optional instance
-
getOptionalSnippet
public java.util.Optional<org.gitlab4j.api.models.Snippet> getOptionalSnippet(java.lang.Long snippetId, boolean downloadContent)
Get a specific snippet as an Optional instance.GitLab Endpoint: GET /snippets/:snippet_id
- Parameters:
snippetId
- the ID of the snippet to get the Optional instance fordownloadContent
- indicating whether to download the snippet content- Returns:
- the specified Snippet as an Optional instance
-
createSnippet
public org.gitlab4j.api.models.Snippet createSnippet(java.lang.String title, java.lang.String fileName, java.lang.String content) throws GitLabApiException
Create a new Snippet.- Parameters:
title
- the title of the snippetfileName
- the file name of the snippetcontent
- the content of the snippet- Returns:
- the created Snippet
- Throws:
GitLabApiException
- if any exception occurs
-
createSnippet
public org.gitlab4j.api.models.Snippet createSnippet(java.lang.String title, java.lang.String fileName, java.lang.String content, org.gitlab4j.api.models.Visibility visibility, java.lang.String description) throws GitLabApiException
Create a new Snippet.- Parameters:
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 snippet- Returns:
- the created Snippet
- Throws:
GitLabApiException
- if any exception occurs
-
deleteSnippet
public void deleteSnippet(java.lang.Long snippetId) throws GitLabApiException
Removes Snippet.GitLab Endpoint: DELETE /snippets/:id
- Parameters:
snippetId
- the snippet ID to remove- Throws:
GitLabApiException
- if any exception occurs
-
-