idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
34,700
public List < DeployKey > getDeployKeys ( int page , int perPage ) throws GitLabApiException { Response response = get ( Response . Status . OK , getPageQueryParams ( page , perPage ) , "deploy_keys" ) ; return ( response . readEntity ( new GenericType < List < DeployKey > > ( ) { } ) ) ; }
Get a list of all deploy keys across all projects of the GitLab instance using the specified page and per page settings . This method requires admin access .
34,701
public Pager < DeployKey > getDeployKeys ( int itemsPerPage ) throws GitLabApiException { return ( new Pager < DeployKey > ( this , DeployKey . class , itemsPerPage , null , "deploy_keys" ) ) ; }
Get a Pager of all deploy keys across all projects of the GitLab instance . This method requires admin access .
34,702
public List < DeployKey > getProjectDeployKeys ( Object projectIdOrPath , int page , int perPage ) throws GitLabApiException { Response response = get ( Response . Status . OK , getPageQueryParams ( page , perPage ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "deploy_keys" ) ; return ( response . readEntity ( new GenericType < List < DeployKey > > ( ) { } ) ) ; }
Get a list of the deploy keys for the specified project using the specified page and per page settings . This method requires admin access .
34,703
public Pager < DeployKey > getProjectDeployKeys ( Object projectIdOrPath , int itemsPerPage ) throws GitLabApiException { return ( new Pager < DeployKey > ( this , DeployKey . class , itemsPerPage , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "deploy_keys" ) ) ; }
Get a Pager of the deploy keys for the specified project . This method requires admin access .
34,704
public DeployKey getDeployKey ( Object projectIdOrPath , Integer keyId ) throws GitLabApiException { if ( keyId == null ) { throw new RuntimeException ( "keyId cannot be null" ) ; } Response response = get ( Response . Status . OK , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "deploy_keys" , keyId ) ; return ( response . readEntity ( DeployKey . class ) ) ; }
Get a single deploy key for the specified project .
34,705
public Optional < DeployKey > getOptionalDeployKey ( Object projectIdOrPath , Integer keyId ) { try { return ( Optional . ofNullable ( getDeployKey ( projectIdOrPath , keyId ) ) ) ; } catch ( GitLabApiException glae ) { return ( GitLabApi . createOptionalFromException ( glae ) ) ; } }
Get a single deploy key for the specified project as an Optional instance .
34,706
public DeployKey addDeployKey ( Object projectIdOrPath , String title , String key , Boolean canPush ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "title" , title , true ) . withParam ( "key" , key , true ) . withParam ( "can_push" , canPush ) ; Response response = post ( Response . Status . CREATED , formData , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "deploy_keys" ) ; return ( response . readEntity ( DeployKey . class ) ) ; }
Creates a new deploy key for a project .
34,707
public void deleteDeployKey ( Object projectIdOrPath , Integer keyId ) throws GitLabApiException { if ( keyId == null ) { throw new RuntimeException ( "keyId cannot be null" ) ; } delete ( Response . Status . OK , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "deploy_keys" , keyId ) ; }
Removes a deploy key from the project . If the deploy key is used only for this project it will be deleted from the system .
34,708
public DeployKey enableDeployKey ( Object projectIdOrPath , Integer keyId ) throws GitLabApiException { if ( keyId == null ) { throw new RuntimeException ( "keyId cannot be null" ) ; } Response response = post ( Response . Status . CREATED , ( Form ) null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "deploy_keys" , keyId , "enable" ) ; return ( response . readEntity ( DeployKey . class ) ) ; }
Enables a deploy key for a project so this can be used . Returns the enabled key when successful .
34,709
public Stream < MergeRequest > getMergeRequestsStream ( MergeRequestFilter filter ) throws GitLabApiException { return ( getMergeRequests ( filter , getDefaultPerPage ( ) ) . stream ( ) ) ; }
Get all merge requests matching the filter as a Stream .
34,710
public Stream < MergeRequest > getMergeRequestsStream ( Object projectIdOrPath , MergeRequestState state ) throws GitLabApiException { return ( getMergeRequests ( projectIdOrPath , state , getDefaultPerPage ( ) ) . stream ( ) ) ; }
Get all merge requests with a specific state for the specified project as a Stream .
34,711
public MergeRequest getMergeRequest ( Object projectIdOrPath , Integer mergeRequestIid ) throws GitLabApiException { Response response = get ( Response . Status . OK , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "merge_requests" , mergeRequestIid ) ; return ( response . readEntity ( MergeRequest . class ) ) ; }
Get information about a single merge request .
34,712
public Optional < MergeRequest > getOptionalMergeRequest ( Object projectIdOrPath , Integer mergeRequestIid ) { try { return ( Optional . ofNullable ( getMergeRequest ( projectIdOrPath , mergeRequestIid ) ) ) ; } catch ( GitLabApiException glae ) { return ( GitLabApi . createOptionalFromException ( glae ) ) ; } }
Get information about a single merge request as an Optional instance .
34,713
public Pager < Commit > getCommits ( Object projectIdOrPath , int mergeRequestIid , int itemsPerPage ) throws GitLabApiException { return ( new Pager < Commit > ( this , Commit . class , itemsPerPage , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "merge_requests" , mergeRequestIid , "commits" ) ) ; }
Get a Pager of merge request commits .
34,714
public Stream < Commit > getCommitsStream ( Object projectIdOrPath , int mergeRequestIid ) throws GitLabApiException { return ( getCommits ( projectIdOrPath , mergeRequestIid , getDefaultPerPage ( ) ) . stream ( ) ) ; }
Get a Stream of merge request commits .
34,715
public MergeRequest cancelMergeRequest ( Object projectIdOrPath , Integer mergeRequestIid ) throws GitLabApiException { if ( mergeRequestIid == null ) { throw new RuntimeException ( "mergeRequestIid cannot be null" ) ; } Response response = put ( Response . Status . OK , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "merge_requests" , mergeRequestIid , "cancel_merge_when_pipeline_succeeds" ) ; return ( response . readEntity ( MergeRequest . class ) ) ; }
Cancel merge when pipeline succeeds . If you don t have permissions to accept this merge request you ll get a 401 . If the merge request is already merged or closed you get 405 and error message Method Not Allowed . In case the merge request is not set to be merged when the pipeline succeeds you ll also get a 406 error .
34,716
public MergeRequest approveMergeRequest ( Object projectIdOrPath , Integer mergeRequestIid , String sha ) throws GitLabApiException { if ( mergeRequestIid == null ) { throw new RuntimeException ( "mergeRequestIid cannot be null" ) ; } Form formData = new GitLabApiForm ( ) . withParam ( "sha" , sha ) ; Response response = post ( Response . Status . OK , formData , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "merge_requests" , mergeRequestIid , "approve" ) ; return ( response . readEntity ( MergeRequest . class ) ) ; }
Approve a merge request .
34,717
public MergeRequest unapproveMergeRequest ( Object projectIdOrPath , Integer mergeRequestIid ) throws GitLabApiException { if ( mergeRequestIid == null ) { throw new RuntimeException ( "mergeRequestIid cannot be null" ) ; } Response response = post ( Response . Status . OK , ( Form ) null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "merge_requests" , mergeRequestIid , "unapprove" ) ; return ( response . readEntity ( MergeRequest . class ) ) ; }
Unapprove a merge request .
34,718
public List < Participant > getParticipants ( Object projectIdOrPath , Integer mergeRequestIid ) throws GitLabApiException { return ( getParticipants ( projectIdOrPath , mergeRequestIid , getDefaultPerPage ( ) ) . all ( ) ) ; }
Get list of participants of merge request .
34,719
public Pager < Participant > getParticipants ( Object projectIdOrPath , Integer mergeRequestIid , int itemsPerPage ) throws GitLabApiException { return new Pager < Participant > ( this , Participant . class , itemsPerPage , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "merge_requests" , mergeRequestIid , "participants" ) ; }
Get a Pager of the participants of merge request .
34,720
public Stream < Participant > getParticipantsStream ( Object projectIdOrPath , Integer mergeRequestIid ) throws GitLabApiException { return ( getParticipants ( projectIdOrPath , mergeRequestIid , getDefaultPerPage ( ) ) . stream ( ) ) ; }
Get Stream of participants of merge request .
34,721
public List < Issue > getClosesIssues ( Object projectIdOrPath , Integer mergeRequestIid ) throws GitLabApiException { return ( getClosesIssues ( projectIdOrPath , mergeRequestIid , getDefaultPerPage ( ) ) . all ( ) ) ; }
Get list containing all the issues that would be closed by merging the provided merge request .
34,722
public Pager < Issue > getClosesIssues ( Object projectIdOrPath , Integer mergeRequestIid , int itemsPerPage ) throws GitLabApiException { return new Pager < Issue > ( this , Issue . class , itemsPerPage , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "merge_requests" , mergeRequestIid , "closes_issues" ) ; }
Get a Pager containing all the issues that would be closed by merging the provided merge request .
34,723
public Stream < Issue > getClosesIssuesStream ( Object projectIdOrPath , Integer mergeRequestIid ) throws GitLabApiException { return ( getClosesIssues ( projectIdOrPath , mergeRequestIid , getDefaultPerPage ( ) ) . stream ( ) ) ; }
Get Stream containing all the issues that would be closed by merging the provided merge request .
34,724
public List < Discussion > getIssueDiscussions ( Object projectIdOrPath , Integer issueIid ) throws GitLabApiException { Pager < Discussion > pager = getIssueDiscussionsPager ( projectIdOrPath , issueIid , getDefaultPerPage ( ) ) ; return ( pager . all ( ) ) ; }
Get a list of all discussions for the specified issue .
34,725
public Pager < Discussion > getIssueDiscussionsPager ( Object projectIdOrPath , Integer issueIid , int itemsPerPage ) throws GitLabApiException { return ( new Pager < Discussion > ( this , Discussion . class , itemsPerPage , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "issues" , issueIid , "discussions" ) ) ; }
Get a Pager of Discussion instances for the specified issue .
34,726
public Stream < Discussion > getIssueDiscussionsStream ( Object projectIdOrPath , Integer issueIid ) throws GitLabApiException { Pager < Discussion > pager = getIssueDiscussionsPager ( projectIdOrPath , issueIid , getDefaultPerPage ( ) ) ; return ( pager . stream ( ) ) ; }
Get a Stream of Discussion instances for the specified issue .
34,727
public List < Discussion > getSnippetDiscussions ( Object projectIdOrPath , Integer snippetId ) throws GitLabApiException { Pager < Discussion > pager = getSnippetDiscussionsPager ( projectIdOrPath , snippetId , getDefaultPerPage ( ) ) ; return ( pager . all ( ) ) ; }
Get a list of all discussions for the specified snippet .
34,728
public Pager < Discussion > getSnippetDiscussionsPager ( Object projectIdOrPath , Integer snippetId , int itemsPerPage ) throws GitLabApiException { return ( new Pager < Discussion > ( this , Discussion . class , itemsPerPage , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "snippets" , snippetId , "discussions" ) ) ; }
Get a Pager of Discussion instances for the specified snippet .
34,729
public Stream < Discussion > getSnippetDiscussionsStream ( Object projectIdOrPath , Integer snippetId ) throws GitLabApiException { Pager < Discussion > pager = getSnippetDiscussionsPager ( projectIdOrPath , snippetId , getDefaultPerPage ( ) ) ; return ( pager . stream ( ) ) ; }
Get a Stream of Discussion instances for the specified snippet .
34,730
public List < Discussion > getEpicDiscussions ( Object projectIdOrPath , Integer epicId ) throws GitLabApiException { Pager < Discussion > pager = getEpicDiscussionsPager ( projectIdOrPath , epicId , getDefaultPerPage ( ) ) ; return ( pager . all ( ) ) ; }
Get a list of all discussions for the specified epic .
34,731
public Pager < Discussion > getEpicDiscussionsPager ( Object projectIdOrPath , Integer epicId , int itemsPerPage ) throws GitLabApiException { return ( new Pager < Discussion > ( this , Discussion . class , itemsPerPage , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "epics" , epicId , "discussions" ) ) ; }
Get a Pager of Discussion instances for the specified epic .
34,732
public Stream < Discussion > getEpicDiscussionsStream ( Object projectIdOrPath , Integer epicId ) throws GitLabApiException { Pager < Discussion > pager = getEpicDiscussionsPager ( projectIdOrPath , epicId , getDefaultPerPage ( ) ) ; return ( pager . stream ( ) ) ; }
Get a Stream of Discussion instances for the specified epic .
34,733
public List < Discussion > getMergeRequestDiscussions ( Object projectIdOrPath , Integer mergeRequestIid ) throws GitLabApiException { Pager < Discussion > pager = getMergeRequestDiscussionsPager ( projectIdOrPath , mergeRequestIid , getDefaultPerPage ( ) ) ; return ( pager . all ( ) ) ; }
Get a list of all discussions for the specified merge request .
34,734
public Pager < Discussion > getMergeRequestDiscussionsPager ( Object projectIdOrPath , Integer mergeRequestIid , int itemsPerPage ) throws GitLabApiException { return ( new Pager < Discussion > ( this , Discussion . class , itemsPerPage , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "merge_requests" , mergeRequestIid , "discussions" ) ) ; }
Get a Pager of Discussion instances for the specified merge request .
34,735
public Stream < Discussion > getMergeRequestDiscussionsStream ( Object projectIdOrPath , Integer mergeRequestIid ) throws GitLabApiException { Pager < Discussion > pager = getMergeRequestDiscussionsPager ( projectIdOrPath , mergeRequestIid , getDefaultPerPage ( ) ) ; return ( pager . stream ( ) ) ; }
Get a Stream of Discussion instances for the specified merge request .
34,736
public Discussion resolveMergeRequestDiscussion ( Object projectIdOrPath , Integer mergeRequestIid , Integer discussionId , Boolean resolved ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "resolved" , resolved , true ) ; Response response = put ( Response . Status . OK , formData . asMap ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "merge_requests" , mergeRequestIid , "discussions" ) ; return ( response . readEntity ( Discussion . class ) ) ; }
Resolve or unresolve whole discussion of a merge request .
34,737
public void deleteMergeRequestDiscussionNote ( Object projectIdOrPath , Integer mergeRequestIid , Integer discussionId , Integer noteId ) throws GitLabApiException { delete ( Response . Status . OK , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "merge_requests" , mergeRequestIid , "discussions" , noteId ) ; }
Deletes an existing discussion note of a merge request .
34,738
public List < Discussion > getCommitDiscussions ( Object projectIdOrPath , Integer commitId ) throws GitLabApiException { Pager < Discussion > pager = getCommitDiscussionsPager ( projectIdOrPath , commitId , getDefaultPerPage ( ) ) ; return ( pager . all ( ) ) ; }
Get a list of all discussions for the specified commit .
34,739
public List < Discussion > getCommitDiscussions ( Object projectIdOrPath , Integer commitId , int maxItems ) throws GitLabApiException { if ( maxItems < 1 ) { return ( getCommitDiscussions ( projectIdOrPath , commitId ) ) ; } else { Response response = get ( Response . Status . OK , getPerPageQueryParam ( maxItems ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "commits" , commitId , "discussions" ) ; return ( response . readEntity ( new GenericType < List < Discussion > > ( ) { } ) ) ; } }
Get a list of discussions for the specified commit .
34,740
public Pager < Discussion > getCommitDiscussionsPager ( Object projectIdOrPath , Integer commitId , int itemsPerPage ) throws GitLabApiException { return ( new Pager < Discussion > ( this , Discussion . class , itemsPerPage , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "commits" , commitId , "discussions" ) ) ; }
Get a Pager of Discussion instances for the specified commit .
34,741
public Stream < Discussion > getCommitDiscussionsStream ( Object projectIdOrPath , Integer commitId ) throws GitLabApiException { Pager < Discussion > pager = getCommitDiscussionsPager ( projectIdOrPath , commitId , getDefaultPerPage ( ) ) ; return ( pager . stream ( ) ) ; }
Get a Stream of Discussion instances for the specified commit .
34,742
public Optional < RepositoryFile > getOptionalFileInfo ( Object projectIdOrPath , String filePath , String ref ) { try { return ( Optional . ofNullable ( getFileInfo ( projectIdOrPath , filePath , ref ) ) ) ; } catch ( GitLabApiException glae ) { return ( GitLabApi . createOptionalFromException ( glae ) ) ; } }
Get an Optional instance with the value holding information on a file in the repository . Allows you to receive information about file in repository like name size . Only works with GitLab 11 . 1 . 0 + value will be an empty object for earlier versions of GitLab .
34,743
public RepositoryFile getFileInfo ( Object projectIdOrPath , String filePath , String ref ) throws GitLabApiException { Form form = new Form ( ) ; addFormParam ( form , "ref" , ref , true ) ; Response response = head ( Response . Status . OK , form . asMap ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "repository" , "files" , urlEncode ( filePath ) ) ; RepositoryFile file = new RepositoryFile ( ) ; file . setBlobId ( response . getHeaderString ( "X-Gitlab-Blob-Id" ) ) ; file . setCommitId ( response . getHeaderString ( "X-Gitlab-Commit-Id" ) ) ; file . setEncoding ( response . getHeaderString ( "X-Gitlab-Encoding" ) ) ; file . setFileName ( response . getHeaderString ( "X-Gitlab-File-Name" ) ) ; file . setFilePath ( response . getHeaderString ( "X-Gitlab-File-Path" ) ) ; file . setLastCommitId ( response . getHeaderString ( "X-Gitlab-Last-Commit-Id" ) ) ; file . setRef ( response . getHeaderString ( "X-Gitlab-Ref" ) ) ; String sizeStr = response . getHeaderString ( "X-Gitlab-Size" ) ; file . setSize ( sizeStr != null ? Integer . valueOf ( sizeStr ) : - 1 ) ; return ( file ) ; }
Get information on a file in the repository . Allows you to receive information about file in repository like name size . Only works with GitLab 11 . 1 . 0 + returns an empty object for earlier versions of GitLab .
34,744
public Optional < RepositoryFile > getOptionalFile ( Object projectIdOrPath , String filePath , String ref ) { try { return ( Optional . ofNullable ( getFile ( projectIdOrPath , filePath , ref , true ) ) ) ; } catch ( GitLabApiException glae ) { return ( GitLabApi . createOptionalFromException ( glae ) ) ; } }
Get an Optional instance with the value holding information and content for a file in the repository . Allows you to receive information about file in repository like name size and content . Only works with GitLab 11 . 1 . 0 + value will be an empty object for earlier versions of GitLab .
34,745
public RepositoryFile getFile ( Object projectIdOrPath , String filePath , String ref , boolean includeContent ) throws GitLabApiException { if ( ! includeContent ) { return ( getFileInfo ( projectIdOrPath , filePath , ref ) ) ; } Form form = new Form ( ) ; addFormParam ( form , "ref" , ref , true ) ; Response response = get ( Response . Status . OK , form . asMap ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "repository" , "files" , urlEncode ( filePath ) ) ; return ( response . readEntity ( RepositoryFile . class ) ) ; }
Get file from repository . Allows you to receive information about file in repository like name size and optionally content . Note that file content is Base64 encoded .
34,746
public RepositoryFile createFile ( Object projectIdOrPath , RepositoryFile file , String branchName , String commitMessage ) throws GitLabApiException { Form formData = createForm ( file , branchName , commitMessage ) ; Response response ; if ( isApiVersion ( ApiVersion . V3 ) ) { response = post ( Response . Status . CREATED , formData , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "repository" , "files" ) ; } else { response = post ( Response . Status . CREATED , formData , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "repository" , "files" , urlEncode ( file . getFilePath ( ) ) ) ; } return ( response . readEntity ( RepositoryFile . class ) ) ; }
Create new file in repository
34,747
public File getRawFile ( Object projectIdOrPath , String commitOrBranchName , String filepath , File directory ) throws GitLabApiException { InputStream in = getRawFile ( projectIdOrPath , commitOrBranchName , filepath ) ; try { if ( directory == null ) { directory = new File ( System . getProperty ( "java.io.tmpdir" ) ) ; } String filename = new File ( filepath ) . getName ( ) ; File file = new File ( directory , filename ) ; Files . copy ( in , file . toPath ( ) , StandardCopyOption . REPLACE_EXISTING ) ; return ( file ) ; } catch ( IOException ioe ) { throw new GitLabApiException ( ioe ) ; } finally { try { in . close ( ) ; } catch ( IOException ignore ) { } } }
Get the raw file for the file by commit sha and path . Thye file will be saved to the specified directory . If the file already exists in the directory it will be overwritten .
34,748
public InputStream getRawFile ( Object projectIdOrPath , String commitOrBranchName , String filepath ) throws GitLabApiException { if ( isApiVersion ( ApiVersion . V3 ) ) { Form formData = new GitLabApiForm ( ) . withParam ( "file_path" , filepath , true ) ; Response response = getWithAccepts ( Response . Status . OK , formData . asMap ( ) , MediaType . MEDIA_TYPE_WILDCARD , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "repository" , "blobs" , commitOrBranchName ) ; return ( response . readEntity ( InputStream . class ) ) ; } else { Form formData = new GitLabApiForm ( ) . withParam ( "ref" , commitOrBranchName , true ) ; Response response = getWithAccepts ( Response . Status . OK , formData . asMap ( ) , MediaType . MEDIA_TYPE_WILDCARD , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "repository" , "files" , urlEncode ( filepath ) , "raw" ) ; return ( response . readEntity ( InputStream . class ) ) ; } }
Get the raw file contents for a file by commit sha and path .
34,749
protected Form createForm ( RepositoryFile file , String branchName , String commitMessage ) { Form form = new Form ( ) ; if ( isApiVersion ( ApiVersion . V3 ) ) { addFormParam ( form , "file_path" , file . getFilePath ( ) , true ) ; addFormParam ( form , "branch_name" , branchName , true ) ; } else { addFormParam ( form , "branch" , branchName , true ) ; } addFormParam ( form , "encoding" , file . getEncoding ( ) , false ) ; String content = file . getContent ( ) ; if ( content == null ) { throw new IllegalArgumentException ( "content cannot be null" ) ; } form . param ( "content" , content ) ; addFormParam ( form , "commit_message" , commitMessage , true ) ; return ( form ) ; }
Gets the query params based on the API version .
34,750
public List < SystemHook > getSystemHooks ( int page , int perPage ) throws GitLabApiException { Response response = get ( Response . Status . OK , getPageQueryParams ( page , perPage ) , "hooks" ) ; return ( response . readEntity ( new GenericType < List < SystemHook > > ( ) { } ) ) ; }
Get a list of all system hooks using the specified page and per page settings . This method requires admin access .
34,751
public Pager < SystemHook > getSystemHooks ( int itemsPerPage ) throws GitLabApiException { return ( new Pager < SystemHook > ( this , SystemHook . class , itemsPerPage , null , "hooks" ) ) ; }
Get a Pager of all system hooks . This method requires admin access .
34,752
public SystemHook addSystemHook ( String url , String token , Boolean pushEvents , Boolean tagPushEvents , Boolean enablSsslVerification ) throws GitLabApiException { if ( url == null ) { throw new RuntimeException ( "url cannot be null" ) ; } GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "url" , url , true ) . withParam ( "token" , token ) . withParam ( "push_events" , pushEvents ) . withParam ( "tag_push_events" , tagPushEvents ) . withParam ( "enable_ssl_verification" , enablSsslVerification ) ; Response response = post ( Response . Status . CREATED , formData , "hooks" ) ; return ( response . readEntity ( SystemHook . class ) ) ; }
Add a new system hook . This method requires admin access .
34,753
public List < Label > getLabels ( Object projectIdOrPath ) throws GitLabApiException { return ( getLabels ( projectIdOrPath , getDefaultPerPage ( ) ) . all ( ) ) ; }
Get all labels of the specified project .
34,754
public Pager < Label > getLabels ( Object projectIdOrPath , int itemsPerPage ) throws GitLabApiException { return ( new Pager < Label > ( this , Label . class , itemsPerPage , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "labels" ) ) ; }
Get a Pager of all labels of the specified project .
34,755
public Stream < Label > getLabelsStream ( Object projectIdOrPath ) throws GitLabApiException { return ( getLabels ( projectIdOrPath , getDefaultPerPage ( ) ) . stream ( ) ) ; }
Get a Stream of all labels of the specified project .
34,756
public void deleteLabel ( Object projectIdOrPath , String name ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "name" , name , true ) ; Response . Status expectedStatus = ( isApiVersion ( GitLabApi . ApiVersion . V3 ) ? Response . Status . OK : Response . Status . NO_CONTENT ) ; delete ( expectedStatus , formData . asMap ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "labels" ) ; }
Delete the specified label
34,757
public Label subscribeLabel ( Object projectIdOrPath , Integer labelId ) throws GitLabApiException { Response response = post ( Response . Status . NOT_MODIFIED , getDefaultPerPageParam ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "labels" , labelId , "subscribe" ) ; return ( response . readEntity ( Label . class ) ) ; }
Subscribe a specified label
34,758
public static Map < String , Object > createProxyClientConfig ( String proxyUri ) { return ( createProxyClientConfig ( proxyUri , null , null ) ) ; }
Create a Map instance with properties set up to use a proxy server that can be passed to the GitLabAPi constructors and login methods to configure the GitLabApi instance to use a proxy server .
34,759
public static Map < String , Object > createProxyClientConfig ( String proxyUri , String username , String password ) { Map < String , Object > clientConfig = new HashMap < > ( ) ; clientConfig . put ( ClientProperties . PROXY_URI , proxyUri ) ; if ( username != null && username . trim ( ) . length ( ) > 0 ) { clientConfig . put ( ClientProperties . PROXY_USERNAME , username ) ; } if ( password != null && password . trim ( ) . length ( ) > 0 ) { clientConfig . put ( ClientProperties . PROXY_PASSWORD , password ) ; } return ( clientConfig ) ; }
Create a Map instance set up to use a proxy server that can be passed to the GitLabAPi constructors and login methods to configure the GitLabApi instance to use a proxy server .
34,760
public static String getTimestamp ( boolean withMsec ) { return ( withMsec ? SafeDateFormatter . getDateFormat ( PATTERN_MSEC ) . format ( new Date ( ) ) : SafeDateFormatter . getDateFormat ( PATTERN ) . format ( new Date ( ) ) ) ; }
Get a ISO8601formatted string for the current date and time .
34,761
public static Instant toInstant ( String dateTimeString ) throws ParseException { if ( dateTimeString == null ) { return ( null ) ; } dateTimeString = dateTimeString . trim ( ) ; if ( dateTimeString . endsWith ( "Z" ) ) { return ( Instant . parse ( dateTimeString ) ) ; } else { if ( dateTimeString . endsWith ( "UTC" ) ) { dateTimeString = dateTimeString . replace ( "UTC" , "+0000" ) ; } OffsetDateTime odt = ( dateTimeString . length ( ) > 25 ? OffsetDateTime . parse ( dateTimeString , ODT_WITH_MSEC_PARSER ) : OffsetDateTime . parse ( dateTimeString , ODT_PARSER ) ) ; return ( odt . toInstant ( ) ) ; } }
Parses an ISO8601 formatted string a returns an Instant instance .
34,762
public static Date toDate ( String dateTimeString ) throws ParseException { Instant instant = toInstant ( dateTimeString ) ; return ( instant != null ? Date . from ( instant ) : null ) ; }
Parses an ISO8601 formatted string a returns a Date instance .
34,763
public static Calendar toCalendar ( String dateTimeString ) throws ParseException { Date date = toDate ( dateTimeString ) ; if ( date == null ) { return ( null ) ; } Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( date ) ; return ( cal ) ; }
Parses an ISO8601 formatted string a returns a Calendar instance .
34,764
public List < Board > getBoards ( Object projectIdOrPath ) throws GitLabApiException { return ( getBoards ( projectIdOrPath , getDefaultPerPage ( ) ) . all ( ) ) ; }
Lists Issue Boards in the given project .
34,765
public List < Board > getBoards ( Object projectIdOrPath , int page , int perPage ) throws GitLabApiException { Response response = get ( javax . ws . rs . core . Response . Status . OK , getPageQueryParams ( page , perPage ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "boards" ) ; return ( response . readEntity ( new GenericType < List < Board > > ( ) { } ) ) ; }
Get all issue boards for the specified project using the specified page and per page setting
34,766
public Pager < Board > getBoards ( Object projectIdOrPath , int itemsPerPage ) throws GitLabApiException { return ( new Pager < Board > ( this , Board . class , itemsPerPage , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "boards" ) ) ; }
Get a Pager of all issue boards for the specified project .
34,767
public Stream < Board > getBoardsStream ( Object projectIdOrPath ) throws GitLabApiException { return ( getBoards ( projectIdOrPath , getDefaultPerPage ( ) ) . stream ( ) ) ; }
Get a Stream of all issue boards for the specified project .
34,768
public Board getBoard ( Object projectIdOrPath , Integer boardId ) throws GitLabApiException { Response response = get ( Response . Status . OK , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "boards" , boardId ) ; return ( response . readEntity ( Board . class ) ) ; }
Get a single issue board .
34,769
public Optional < Board > getOptionalBoard ( Object projectIdOrPath , Integer boardId ) { try { return ( Optional . ofNullable ( getBoard ( projectIdOrPath , boardId ) ) ) ; } catch ( GitLabApiException glae ) { return ( GitLabApi . createOptionalFromException ( glae ) ) ; } }
Get an issue board as an Optional instance .
34,770
public Board createBoard ( Object projectIdOrPath , String name ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "name" , name , true ) ; Response response = post ( Response . Status . CREATED , formData . asMap ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "boards" ) ; return ( response . readEntity ( Board . class ) ) ; }
Creates a new Issue Board .
34,771
public BoardList updateBoard ( Object projectIdOrPath , Integer boardId , String name , Integer assigneeId , Integer milestoneId , String labels , Integer weight ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "name" , name ) . withParam ( "assignee_id" , assigneeId ) . withParam ( "milestone_id" , milestoneId ) . withParam ( "labels" , labels ) . withParam ( "weight" , weight ) ; Response response = put ( Response . Status . OK , formData . asMap ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "boards" , boardId ) ; return ( response . readEntity ( BoardList . class ) ) ; }
Updates an existing Issue Board .
34,772
public void deleteBoard ( Object projectIdOrPath , Integer boardId ) throws GitLabApiException { delete ( Response . Status . NO_CONTENT , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "boards" , boardId ) ; }
Soft deletes an existing Issue Board .
34,773
public BoardList getBoardList ( Object projectIdOrPath , Integer boardId , Integer listId ) throws GitLabApiException { Response response = get ( Response . Status . OK , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "boards" , boardId , "lists" , listId ) ; return ( response . readEntity ( BoardList . class ) ) ; }
Get a single issue board list .
34,774
public Optional < BoardList > getOptionalBoardList ( Object projectIdOrPath , Integer boardId , Integer listId ) { try { return ( Optional . ofNullable ( getBoardList ( projectIdOrPath , boardId , listId ) ) ) ; } catch ( GitLabApiException glae ) { return ( GitLabApi . createOptionalFromException ( glae ) ) ; } }
Get a single issue board list as an Optional instance .
34,775
public BoardList createBoardList ( Object projectIdOrPath , Integer boardId , Integer labelId ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "label_id" , labelId , true ) ; Response response = post ( Response . Status . CREATED , formData , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "boards" , boardId , "lists" ) ; return ( response . readEntity ( BoardList . class ) ) ; }
Creates a new Issue Board list .
34,776
public BoardList updateBoardList ( Object projectIdOrPath , Integer boardId , Integer listId , Integer position ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "position" , position , true ) ; Response response = putWithFormData ( Response . Status . OK , formData , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "boards" , boardId , "lists" , listId ) ; return ( response . readEntity ( BoardList . class ) ) ; }
Updates an existing Issue Board list . This call is used to change list position .
34,777
public void deleteBoardList ( Object projectIdOrPath , Integer boardId , Integer listId ) throws GitLabApiException { delete ( Response . Status . NO_CONTENT , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "boards" , boardId , "lists" , listId ) ; }
Soft deletes an existing Issue Board list . Only for admins and project owners .
34,778
private void fixJiraIssueTransitionId ( Map < String , Object > properties ) { if ( properties != null ) { Object jiraIssueTransitionId = properties . get ( JIRA_ISSUE_TRANSITION_ID_PROP ) ; if ( jiraIssueTransitionId instanceof String ) { if ( ( ( String ) jiraIssueTransitionId ) . trim ( ) . isEmpty ( ) ) { properties . put ( JIRA_ISSUE_TRANSITION_ID_PROP , null ) ; } else { properties . put ( JIRA_ISSUE_TRANSITION_ID_PROP , Integer . valueOf ( ( String ) jiraIssueTransitionId ) ) ; } } } }
Make sure jiraIssueTransitionId is an integer and not an empty string .
34,779
public Pipeline getPipeline ( Object projectIdOrPath , int pipelineId ) throws GitLabApiException { Response response = get ( Response . Status . OK , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "pipelines" , pipelineId ) ; return ( response . readEntity ( Pipeline . class ) ) ; }
Get single pipelines in a project .
34,780
public void deletePipeline ( Object projectIdOrPath , int pipelineId ) throws GitLabApiException { delete ( Response . Status . ACCEPTED , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "pipelines" , pipelineId ) ; }
Delete a pipeline from a project .
34,781
public Pipeline retryPipelineJob ( Object projectIdOrPath , int pipelineId ) throws GitLabApiException { GitLabApiForm formData = null ; Response response = post ( Response . Status . OK , formData , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "pipelines" , pipelineId , "retry" ) ; return ( response . readEntity ( Pipeline . class ) ) ; }
Retry a job in specified pipelines in a project .
34,782
public List < PipelineSchedule > getPipelineSchedules ( Object projectIdOrPath ) throws GitLabApiException { return ( getPipelineSchedules ( projectIdOrPath , getDefaultPerPage ( ) ) . all ( ) ) ; }
Get a list of the project pipeline_schedules for the specified project .
34,783
public List < PipelineSchedule > getPipelineSchedules ( Object projectIdOrPath , int page , int perPage ) throws GitLabApiException { Response response = get ( Response . Status . OK , getPageQueryParams ( page , perPage ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "pipeline_schedules" ) ; return ( response . readEntity ( new GenericType < List < PipelineSchedule > > ( ) { } ) ) ; }
Get list of project pipeline schedules in the specified page range .
34,784
public Pager < PipelineSchedule > getPipelineSchedules ( Object projectIdOrPath , int itemsPerPage ) throws GitLabApiException { return ( new Pager < PipelineSchedule > ( this , PipelineSchedule . class , itemsPerPage , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "pipeline_schedules" ) ) ; }
Get Pager of project pipeline schedule .
34,785
public Stream < PipelineSchedule > getPipelineSchedulesStream ( Object projectIdOrPath ) throws GitLabApiException { return ( getPipelineSchedules ( projectIdOrPath , getDefaultPerPage ( ) ) . stream ( ) ) ; }
Get a Stream of the project pipeline schedule for the specified project .
34,786
public PipelineSchedule getPipelineSchedule ( Object projectIdOrPath , Integer pipelineScheduleId ) throws GitLabApiException { Response response = get ( Response . Status . OK , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "pipeline_schedules" , pipelineScheduleId ) ; return ( response . readEntity ( PipelineSchedule . class ) ) ; }
Get a specific pipeline schedule for project .
34,787
public Optional < PipelineSchedule > getOptionalPipelineSchedule ( Object projectIdOrPath , Integer pipelineScheduleId ) { try { return ( Optional . ofNullable ( getPipelineSchedule ( projectIdOrPath , pipelineScheduleId ) ) ) ; } catch ( GitLabApiException glae ) { return ( GitLabApi . createOptionalFromException ( glae ) ) ; } }
Get a specific pipeline schedule for project as an Optional instance .
34,788
public PipelineSchedule createPipelineSchedule ( Object projectIdOrPath , PipelineSchedule pipelineSchedule ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "description" , pipelineSchedule . getDescription ( ) , true ) . withParam ( "ref" , pipelineSchedule . getRef ( ) , true ) . withParam ( "cron" , pipelineSchedule . getCron ( ) , true ) . withParam ( "cron_timezone" , pipelineSchedule . getCronTimezone ( ) , false ) . withParam ( "active" , pipelineSchedule . getActive ( ) , false ) ; Response response = post ( Response . Status . CREATED , formData , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "pipeline_schedules" ) ; return ( response . readEntity ( PipelineSchedule . class ) ) ; }
create a pipeline schedule for a project .
34,789
public PipelineSchedule updatePipelineSchedule ( Object projectIdOrPath , PipelineSchedule pipelineSchedule ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "description" , pipelineSchedule . getDescription ( ) , false ) . withParam ( "ref" , pipelineSchedule . getRef ( ) , false ) . withParam ( "cron" , pipelineSchedule . getCron ( ) , false ) . withParam ( "cron_timezone" , pipelineSchedule . getCronTimezone ( ) , false ) . withParam ( "active" , pipelineSchedule . getActive ( ) , false ) ; Response response = put ( Response . Status . OK , formData . asMap ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "pipeline_schedules" , pipelineSchedule . getId ( ) ) ; return ( response . readEntity ( PipelineSchedule . class ) ) ; }
Modifies a pipeline schedule for project .
34,790
public PipelineSchedule takeOwnershipPipelineSchedule ( Object projectIdOrPath , Integer pipelineScheduleId ) throws GitLabApiException { Response response = post ( Response . Status . OK , "" , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "pipeline_schedules" , pipelineScheduleId , "take_ownership" ) ; return ( response . readEntity ( PipelineSchedule . class ) ) ; }
Update the owner of the pipeline schedule of a project .
34,791
public Variable createPipelineScheduleVariable ( Object projectIdOrPath , Integer pipelineScheduleId , String key , String value ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "key" , key , true ) . withParam ( "value" , value , true ) ; Response response = post ( Response . Status . CREATED , formData , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "pipeline_schedules" , pipelineScheduleId , "variables" ) ; return ( response . readEntity ( Variable . class ) ) ; }
Create a pipeline schedule variable .
34,792
public void deletePipelineScheduleVariable ( Object projectIdOrPath , Integer pipelineScheduleId , String key ) throws GitLabApiException { Response . Status expectedStatus = ( isApiVersion ( GitLabApi . ApiVersion . V3 ) ? Response . Status . OK : Response . Status . NO_CONTENT ) ; delete ( expectedStatus , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "pipeline_schedules" , pipelineScheduleId , "variables" , key ) ; }
Deletes a pipeline schedule variable .
34,793
public static final int parse ( String durationString ) { durationString = durationString . toLowerCase ( ) ; Matcher matcher = durationPattern . matcher ( durationString ) ; int currentUnitIndex = - 1 ; int seconds = 0 ; Boolean validDuration = null ; while ( matcher . find ( ) && validDuration != Boolean . FALSE ) { validDuration = true ; int numGroups = matcher . groupCount ( ) ; if ( numGroups == 3 ) { String unit = matcher . group ( 3 ) ; int nextUnitIndex = getUnitIndex ( unit ) ; if ( nextUnitIndex > currentUnitIndex ) { currentUnitIndex = nextUnitIndex ; try { seconds += Long . parseLong ( matcher . group ( 2 ) ) * TIME_UNIT_MULTIPLIERS [ nextUnitIndex ] ; } catch ( NumberFormatException nfe ) { validDuration = false ; } } else { validDuration = false ; } } else { validDuration = false ; } } if ( validDuration != Boolean . TRUE ) { throw new IllegalArgumentException ( String . format ( "'%s' is not a valid duration" , durationString ) ) ; } return ( seconds ) ; }
Parses a human readable duration string and calculates the number of seconds it represents .
34,794
public Pager < Milestone > getGroupMilestones ( Object groupIdOrPath , int itemsPerPage ) throws GitLabApiException { return ( new Pager < Milestone > ( this , Milestone . class , itemsPerPage , null , "groups" , getGroupIdOrPath ( groupIdOrPath ) , "milestones" ) ) ; }
Get a Page of group milestones .
34,795
public Stream < Milestone > getGroupMilestonesStream ( Object groupIdOrPath ) throws GitLabApiException { return ( getGroupMilestones ( groupIdOrPath , getDefaultPerPage ( ) ) . stream ( ) ) ; }
Get a Stream of group milestones .
34,796
public List < Milestone > getGroupMilestones ( Object groupIdOrPath , MilestoneState state ) throws GitLabApiException { Form formData = new GitLabApiForm ( ) . withParam ( "state" , state ) . withParam ( PER_PAGE_PARAM , getDefaultPerPage ( ) ) ; Response response = get ( Response . Status . OK , formData . asMap ( ) , "groups" , getGroupIdOrPath ( groupIdOrPath ) , "milestones" ) ; return ( response . readEntity ( new GenericType < List < Milestone > > ( ) { } ) ) ; }
Get a list of group milestones that have the specified state .
34,797
public Milestone getGroupMilestone ( Object groupIdOrPath , Integer milestoneId ) throws GitLabApiException { Response response = get ( Response . Status . OK , getDefaultPerPageParam ( ) , "groups" , getGroupIdOrPath ( groupIdOrPath ) , "milestones" , milestoneId ) ; return ( response . readEntity ( Milestone . class ) ) ; }
Get the specified group milestone .
34,798
public List < Issue > getGroupIssues ( Object groupIdOrPath , Integer milestoneId ) throws GitLabApiException { Response response = get ( Response . Status . OK , getDefaultPerPageParam ( ) , "groups" , getGroupIdOrPath ( groupIdOrPath ) , "milestones" , milestoneId , "issues" ) ; return ( response . readEntity ( new GenericType < List < Issue > > ( ) { } ) ) ; }
Get the list of issues associated with the specified group milestone .
34,799
public List < MergeRequest > getGroupMergeRequest ( Object groupIdOrPath , Integer milestoneId ) throws GitLabApiException { Response response = get ( Response . Status . OK , getDefaultPerPageParam ( ) , "groups" , getGroupIdOrPath ( groupIdOrPath ) , "milestones" , milestoneId , "merge_requests" ) ; return ( response . readEntity ( new GenericType < List < MergeRequest > > ( ) { } ) ) ; }
Get the list of merge requests associated with the specified group milestone .