idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
158,000
public void deleteVariable ( Object projectIdOrPath , String key ) throws GitLabApiException { delete ( Response . Status . NO_CONTENT , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "variables" , key ) ; }
Deletes a project variable .
59
6
158,001
public static String getShortRequestDump ( String fromMethod , HttpServletRequest request ) { return ( getShortRequestDump ( fromMethod , false , request ) ) ; }
Build a String containing a very short multi - line dump of an HTTP request .
39
16
158,002
public static String getShortRequestDump ( String fromMethod , boolean includeHeaders , HttpServletRequest request ) { StringBuilder dump = new StringBuilder ( ) ; dump . append ( "Timestamp : " ) . append ( ISO8601 . getTimestamp ( ) ) . append ( "\n" ) ; dump . append ( "fromMethod : " ) . append ( fromMethod ) . append ( "\n" ) ; dump . append ( "Method : " ) . append ( request . getMethod ( ) ) . append ( ' ' ) ; dump . append ( "Scheme : " ) . append ( request . getScheme ( ) ) . append ( ' ' ) ; dump . append ( "URI : " ) . append ( request . getRequestURI ( ) ) . append ( ' ' ) ; dump . append ( "Query-String : " ) . append ( request . getQueryString ( ) ) . append ( ' ' ) ; dump . append ( "Auth-Type : " ) . append ( request . getAuthType ( ) ) . append ( ' ' ) ; dump . append ( "Remote-Addr : " ) . append ( request . getRemoteAddr ( ) ) . append ( ' ' ) ; dump . append ( "Scheme : " ) . append ( request . getScheme ( ) ) . append ( ' ' ) ; dump . append ( "Content-Type : " ) . append ( request . getContentType ( ) ) . append ( ' ' ) ; dump . append ( "Content-Length: " ) . append ( request . getContentLength ( ) ) . append ( ' ' ) ; if ( includeHeaders ) { dump . append ( "Headers :\n" ) ; Enumeration < String > headers = request . getHeaderNames ( ) ; while ( headers . hasMoreElements ( ) ) { String header = headers . nextElement ( ) ; dump . append ( "\t" ) . append ( header ) . append ( ": " ) . append ( request . getHeader ( header ) ) . append ( ' ' ) ; } } return ( dump . toString ( ) ) ; }
Build a String containing a short multi - line dump of an HTTP request .
456
15
158,003
public static String getRequestDump ( String fromMethod , HttpServletRequest request , boolean includePostData ) { String shortDump = getShortRequestDump ( fromMethod , request ) ; StringBuilder buf = new StringBuilder ( shortDump ) ; try { buf . append ( "\nAttributes:\n" ) ; Enumeration < String > attrs = request . getAttributeNames ( ) ; while ( attrs . hasMoreElements ( ) ) { String attr = attrs . nextElement ( ) ; buf . append ( "\t" ) . append ( attr ) . append ( ": " ) . append ( request . getAttribute ( attr ) ) . append ( ' ' ) ; } buf . append ( "\nHeaders:\n" ) ; Enumeration < String > headers = request . getHeaderNames ( ) ; while ( headers . hasMoreElements ( ) ) { String header = headers . nextElement ( ) ; buf . append ( "\t" ) . append ( header ) . append ( ": " ) . append ( request . getHeader ( header ) ) . append ( ' ' ) ; } buf . append ( "\nParameters:\n" ) ; Enumeration < String > params = request . getParameterNames ( ) ; while ( params . hasMoreElements ( ) ) { String param = params . nextElement ( ) ; buf . append ( "\t" ) . append ( param ) . append ( ": " ) . append ( request . getParameter ( param ) ) . append ( ' ' ) ; } buf . append ( "\nCookies:\n" ) ; Cookie [ ] cookies = request . getCookies ( ) ; if ( cookies != null ) { for ( Cookie cookie : cookies ) { String cstr = "\t" + cookie . getDomain ( ) + "." + cookie . getPath ( ) + "." + cookie . getName ( ) + ": " + cookie . getValue ( ) + "\n" ; buf . append ( cstr ) ; } } if ( includePostData ) { buf . append ( getPostDataAsString ( request ) ) . append ( "\n" ) ; } return ( buf . toString ( ) ) ; } catch ( IOException e ) { return e . getMessage ( ) ; } }
Build a String containing a multi - line dump of an HTTP request .
489
14
158,004
public static String getPostDataAsString ( HttpServletRequest request ) throws IOException { try ( InputStreamReader reader = new InputStreamReader ( request . getInputStream ( ) , "UTF-8" ) ) { return ( getReaderContentAsString ( reader ) ) ; } }
Reads the POST data from a request into a String and returns it .
62
15
158,005
public static String getReaderContentAsString ( Reader reader ) throws IOException { int count ; final char [ ] buffer = new char [ 2048 ] ; final StringBuilder out = new StringBuilder ( ) ; while ( ( count = reader . read ( buffer , 0 , buffer . length ) ) >= 0 ) { out . append ( buffer , 0 , count ) ; } return ( out . toString ( ) ) ; }
Reads the content of a Reader instance and returns it as a String .
87
15
158,006
@ JsonIgnore public void encodeAndSetContent ( String content ) { encodeAndSetContent ( content != null ? content . getBytes ( ) : null ) ; }
Encodes the provided String using Base64 and sets it as the content . The encoding property of this instance will be set to base64 .
36
28
158,007
@ JsonIgnore public void encodeAndSetContent ( byte [ ] byteContent ) { if ( byteContent == null ) { this . content = null ; return ; } this . content = Base64 . getEncoder ( ) . encodeToString ( byteContent ) ; encoding = "base64" ; }
Encodes the provided byte array using Base64 and sets it as the content . The encoding property of this instance will be set to base64 .
65
29
158,008
public List < WikiPage > getPages ( Object projectIdOrPath , int page , int perPage ) throws GitLabApiException { Response response = get ( Response . Status . OK , getPageQueryParams ( page , perPage ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "wikis" ) ; return response . readEntity ( new GenericType < List < WikiPage > > ( ) { } ) ; }
Get a list of pages in project wiki for the specified page .
97
13
158,009
public WikiPage getPage ( Object projectIdOrPath , String slug ) throws GitLabApiException { Response response = get ( Response . Status . OK , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "wikis" , slug ) ; return ( response . readEntity ( WikiPage . class ) ) ; }
Get a single page of project wiki .
74
8
158,010
public Optional < WikiPage > getOptionalPage ( Object projectIdOrPath , String slug ) { try { return ( Optional . ofNullable ( getPage ( projectIdOrPath , slug ) ) ) ; } catch ( GitLabApiException glae ) { return ( GitLabApi . createOptionalFromException ( glae ) ) ; } }
Get a single page of project wiki as an Optional instance .
74
12
158,011
public WikiPage createPage ( Object projectIdOrPath , String title , String content ) throws GitLabApiException { // one of title or content is required GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "title" , title ) . withParam ( "content" , content ) ; Response response = post ( Response . Status . CREATED , formData , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "wikis" ) ; return ( response . readEntity ( WikiPage . class ) ) ; }
Creates a new project wiki page . The user must have permission to create new wiki page .
122
19
158,012
public WikiPage updatePage ( Object projectIdOrPath , String slug , String title , String content ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "title" , title ) . withParam ( "slug" , slug , true ) . withParam ( "content" , content ) ; Response response = put ( Response . Status . OK , formData . asMap ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "wikis" , slug ) ; return ( response . readEntity ( WikiPage . class ) ) ; }
Updates an existing project wiki page . The user must have permission to change an existing wiki page .
136
20
158,013
public void deletePage ( Object projectIdOrPath , String slug ) throws GitLabApiException { delete ( Response . Status . NO_CONTENT , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "wikis" , slug ) ; }
Deletes an existing project wiki page . This is an idempotent function and deleting a non - existent page does not cause an error .
59
30
158,014
public List < ProtectedBranch > getProtectedBranches ( Object projectIdOrPath ) throws GitLabApiException { return ( getProtectedBranches ( projectIdOrPath , this . getDefaultPerPage ( ) ) . all ( ) ) ; }
Gets a list of protected branches from a project .
56
11
158,015
public Pager < ProtectedBranch > getProtectedBranches ( Object projectIdOrPath , int itemsPerPage ) throws GitLabApiException { return ( new Pager < ProtectedBranch > ( this , ProtectedBranch . class , itemsPerPage , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "protected_branches" ) ) ; }
Gets a Pager of protected branches from a project .
86
12
158,016
public Stream < ProtectedBranch > getProtectedBranchesStream ( Object projectIdOrPath ) throws GitLabApiException { return ( getProtectedBranches ( projectIdOrPath , this . getDefaultPerPage ( ) ) . stream ( ) ) ; }
Gets a Stream of protected branches from a project .
57
11
158,017
public void unprotectBranch ( Integer projectIdOrPath , String branchName ) throws GitLabApiException { delete ( Response . Status . NO_CONTENT , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "protected_branches" , urlEncode ( branchName ) ) ; }
Unprotects the given protected branch or wildcard protected branch .
70
13
158,018
public List < Commit > getCommits ( Object projectIdOrPath , String ref , String path ) throws GitLabApiException { return ( getCommits ( projectIdOrPath , ref , null , null , path , getDefaultPerPage ( ) ) . all ( ) ) ; }
Get a list of file commits in a project
61
9
158,019
public Pager < Commit > getCommits ( Object projectIdOrPath , String ref , Date since , Date until , String path , int itemsPerPage ) throws GitLabApiException { Form formData = new GitLabApiForm ( ) . withParam ( "ref_name" , ref ) . withParam ( "since" , ISO8601 . toString ( since , false ) ) . withParam ( "until" , ISO8601 . toString ( until , false ) ) . withParam ( "path" , ( path == null ? null : urlEncode ( path ) ) ) ; return ( new Pager < Commit > ( this , Commit . class , itemsPerPage , formData . asMap ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "repository" , "commits" ) ) ; }
Get a Pager of repository commits in a project
185
10
158,020
public Commit getCommit ( Object projectIdOrPath , String sha ) throws GitLabApiException { Response response = get ( Response . Status . OK , getDefaultPerPageParam ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "repository" , "commits" , urlEncode ( sha ) ) ; return ( response . readEntity ( Commit . class ) ) ; }
Get a specific commit identified by the commit hash or name of a branch or tag .
92
17
158,021
public Pager < CommitStatus > getCommitStatuses ( Object projectIdOrPath , String sha , CommitStatusFilter filter , int itemsPerPage ) throws GitLabApiException { if ( projectIdOrPath == null ) { throw new RuntimeException ( "projectIdOrPath cannot be null" ) ; } if ( sha == null || sha . trim ( ) . isEmpty ( ) ) { throw new RuntimeException ( "sha cannot be null" ) ; } MultivaluedMap < String , String > queryParams = ( filter != null ? filter . getQueryParams ( ) . asMap ( ) : null ) ; return ( new Pager < CommitStatus > ( this , CommitStatus . class , itemsPerPage , queryParams , "projects" , this . getProjectIdOrPath ( projectIdOrPath ) , "repository" , "commits" , sha , "statuses" ) ) ; }
Get a Pager of repository commit statuses that meet the provided filter .
201
15
158,022
public Stream < CommitStatus > getCommitStatusesStream ( Object projectIdOrPath , String sha , CommitStatusFilter filter ) throws GitLabApiException { return ( getCommitStatuses ( projectIdOrPath , sha , filter , getDefaultPerPage ( ) ) . stream ( ) ) ; }
Get a Stream of repository commit statuses that meet the provided filter .
67
14
158,023
public List < Diff > getDiff ( Object projectIdOrPath , String sha ) throws GitLabApiException { Response response = get ( Response . Status . OK , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "repository" , "commits" , sha , "diff" ) ; return ( response . readEntity ( new GenericType < List < Diff > > ( ) { } ) ) ; }
Get the list of diffs of a commit in a project .
97
13
158,024
public List < Comment > getComments ( Object projectIdOrPath , String sha ) throws GitLabApiException { return ( getComments ( projectIdOrPath , sha , getDefaultPerPage ( ) ) . all ( ) ) ; }
Get the comments of a commit in a project .
52
10
158,025
public Pager < Comment > getComments ( Object projectIdOrPath , String sha , int itemsPerPage ) throws GitLabApiException { return new Pager < Comment > ( this , Comment . class , itemsPerPage , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "repository" , "commits" , sha , "comments" ) ; }
Get a Pager of the comments of a commit in a project .
87
14
158,026
public Stream < Comment > getCommentsStream ( Object projectIdOrPath , String sha ) throws GitLabApiException { return ( getComments ( projectIdOrPath , sha , getDefaultPerPage ( ) ) . stream ( ) ) ; }
Get the comments of a commit in a project as a Stream .
53
13
158,027
public Comment addComment ( Object projectIdOrPath , String sha , String note , String path , Integer line , LineType lineType ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "note" , note , true ) . withParam ( "path" , path ) . withParam ( "line" , line ) . withParam ( "line_type" , lineType ) ; Response response = post ( Response . Status . CREATED , formData , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "repository" , "commits" , sha , "comments" ) ; return ( response . readEntity ( Comment . class ) ) ; }
Add a comment to a commit . In order to post a comment in a particular line of a particular file you must specify the full commit SHA the path the line and lineType should be NEW .
162
39
158,028
public Comment addComment ( Object projectIdOrPath , String sha , String note ) throws GitLabApiException { return ( addComment ( projectIdOrPath , sha , note , null , null , null ) ) ; }
Add a comment to a commit .
49
7
158,029
public Commit createCommit ( Object projectIdOrPath , String branch , String commitMessage , String startBranch , String authorEmail , String authorName , List < CommitAction > actions ) throws GitLabApiException { CommitPayload payload = new CommitPayload ( ) ; payload . setBranch ( branch ) ; payload . setCommitMessage ( commitMessage ) ; payload . setStartBranch ( startBranch ) ; payload . setAuthorEmail ( authorEmail ) ; payload . setAuthorName ( authorName ) ; payload . setActions ( actions ) ; Response response = post ( Response . Status . CREATED , payload , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "repository" , "commits" ) ; return ( response . readEntity ( Commit . class ) ) ; }
Create a commit with multiple files and actions .
175
9
158,030
public NotificationSettings getGlobalNotificationSettings ( ) throws GitLabApiException { Response response = get ( Response . Status . OK , null , "notification_settings" ) ; return ( response . readEntity ( NotificationSettings . class ) ) ; }
Get the global notification settings .
53
6
158,031
public NotificationSettings updateGlobalNotificationSettings ( NotificationSettings settings ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "level" , settings . getLevel ( ) ) . withParam ( "email" , settings . getEmail ( ) ) ; Events events = settings . getEvents ( ) ; if ( events != null ) { formData . withParam ( "new_note" , events . getNewNote ( ) ) . withParam ( "new_issuee" , events . getNewIssue ( ) ) . withParam ( "reopen_issuee" , events . getReopenIssue ( ) ) . withParam ( "close_issuee" , events . getCloseIssue ( ) ) . withParam ( "reassign_issuee" , events . getReassignIssue ( ) ) . withParam ( "new_merge_requeste" , events . getNewMergeRequest ( ) ) . withParam ( "reopen_merge_requeste" , events . getReopenMergeRequest ( ) ) . withParam ( "close_merge_requeste" , events . getCloseMergeRequest ( ) ) . withParam ( "reassign_merge_requeste" , events . getReassignMergeRequest ( ) ) . withParam ( "merge_merge_requeste" , events . getMergeMergeRequest ( ) ) . withParam ( "failed_pipelinee" , events . getFailedPipeline ( ) ) . withParam ( "success_pipelinee" , events . getSuccessPipeline ( ) ) ; } Response response = put ( Response . Status . OK , formData . asMap ( ) , "notification_settings" ) ; return ( response . readEntity ( NotificationSettings . class ) ) ; }
Update the global notification settings .
405
6
158,032
public NotificationSettings getGroupNotificationSettings ( int groupId ) throws GitLabApiException { Response response = get ( Response . Status . OK , null , "groups" , groupId , "notification_settings" ) ; return ( response . readEntity ( NotificationSettings . class ) ) ; }
Get the notification settings for a group .
63
8
158,033
public NotificationSettings getProjectNotificationSettings ( int projectId ) throws GitLabApiException { Response response = get ( Response . Status . OK , null , "projects" , projectId , "notification_settings" ) ; return ( response . readEntity ( NotificationSettings . class ) ) ; }
Get the notification settings for a project .
63
8
158,034
public void addEnum ( E e , String name ) { valuesMap . put ( name , e ) ; namesMap . put ( e , name ) ; }
Add an enum that has a specialized name that does not fit the standard naming conventions .
34
17
158,035
public Session login ( String username , String email , String password ) throws GitLabApiException { if ( ( username == null || username . trim ( ) . length ( ) == 0 ) && ( email == null || email . trim ( ) . length ( ) == 0 ) ) { throw new IllegalArgumentException ( "both username and email cannot be empty or null" ) ; } Form formData = new Form ( ) ; addFormParam ( formData , "email" , email , false ) ; addFormParam ( formData , "password" , password , true ) ; addFormParam ( formData , "login" , username , false ) ; Response response = post ( Response . Status . CREATED , formData , "session" ) ; return ( response . readEntity ( Session . class ) ) ; }
Login to get private token . This functionality is not available on GitLab servers 10 . 2 and above .
171
21
158,036
public Markdown getMarkdown ( String text ) throws GitLabApiException { if ( ! isApiVersion ( ApiVersion . V4 ) ) { throw new GitLabApiException ( "Api version must be v4" ) ; } Form formData = new GitLabApiForm ( ) . withParam ( "text" , text , true ) ; Response response = post ( Response . Status . OK , formData . asMap ( ) , "markdown" ) ; return ( response . readEntity ( Markdown . class ) ) ; }
Render an arbitrary Markdown document .
119
7
158,037
public static String getFilenameFromContentDisposition ( Response response ) { String disposition = response . getHeaderString ( "Content-Disposition" ) ; if ( disposition == null || disposition . trim ( ) . length ( ) == 0 ) return ( null ) ; return ( disposition . replaceFirst ( "(?i)^.*filename=\"([^\"]+)\".*$" , "$1" ) ) ; }
Get the filename from the Content - Disposition header of a JAX - RS response .
86
18
158,038
public static String readFileContents ( File file ) throws IOException { try ( Scanner in = new Scanner ( file ) ) { in . useDelimiter ( "\\Z" ) ; return ( in . next ( ) ) ; } }
Reads the contents of a File to a String .
52
11
158,039
public Stream < Group > getGroupsStream ( String search ) throws GitLabApiException { return ( getGroups ( search , getDefaultPerPage ( ) ) . stream ( ) ) ; }
Get all groups that match your string in their name or path as a Stream .
42
16
158,040
public List < Group > getGroups ( GroupFilter filter ) throws GitLabApiException { return ( getGroups ( filter , getDefaultPerPage ( ) ) . all ( ) ) ; }
Get a list of visible groups for the authenticated user using the provided filter .
42
15
158,041
public Pager < Group > getGroups ( GroupFilter filter , int itemsPerPage ) throws GitLabApiException { GitLabApiForm formData = filter . getQueryParams ( ) ; return ( new Pager < Group > ( this , Group . class , itemsPerPage , formData . asMap ( ) , "groups" ) ) ; }
Get a Pager of visible groups for the authenticated user using the provided filter .
77
16
158,042
public Stream < Group > getGroupsStream ( GroupFilter filter ) throws GitLabApiException { return ( getGroups ( filter , getDefaultPerPage ( ) ) . stream ( ) ) ; }
Get a Stream of visible groups for the authenticated user using the provided filter .
43
15
158,043
public Stream < Group > getSubGroupsStream ( Object groupIdOrPath ) throws GitLabApiException { return ( getSubGroups ( groupIdOrPath , getDefaultPerPage ( ) ) . stream ( ) ) ; }
Get a Stream of visible direct subgroups in this group .
50
12
158,044
public Pager < Project > getProjects ( Object groupIdOrPath , GroupProjectsFilter filter , int itemsPerPage ) throws GitLabApiException { GitLabApiForm formData = filter . getQueryParams ( ) ; return ( new Pager < Project > ( this , Project . class , itemsPerPage , formData . asMap ( ) , "groups" , getGroupIdOrPath ( groupIdOrPath ) , "projects" ) ) ; }
Get a Pager of projects belonging to the specified group ID and filter .
101
15
158,045
public Stream < Project > getProjectsStream ( Object groupIdOrPath , GroupProjectsFilter filter ) throws GitLabApiException { return ( getProjects ( groupIdOrPath , filter , getDefaultPerPage ( ) ) . stream ( ) ) ; }
Get a Stream of projects belonging to the specified group ID and filter .
56
14
158,046
public List < Project > getProjects ( Object groupIdOrPath ) throws GitLabApiException { return ( getProjects ( groupIdOrPath , getDefaultPerPage ( ) ) . all ( ) ) ; }
Get a list of projects belonging to the specified group ID .
47
12
158,047
public List < Project > getProjects ( Object groupIdOrPath , int page , int perPage ) throws GitLabApiException { Response response = get ( Response . Status . OK , getPageQueryParams ( page , perPage ) , "groups" , getGroupIdOrPath ( groupIdOrPath ) , "projects" ) ; return ( response . readEntity ( new GenericType < List < Project > > ( ) { } ) ) ; }
Get a list of projects belonging to the specified group ID in the specified page range .
97
17
158,048
public Pager < Project > getProjects ( Object groupIdOrPath , int itemsPerPage ) throws GitLabApiException { return ( new Pager < Project > ( this , Project . class , itemsPerPage , null , "groups" , getGroupIdOrPath ( groupIdOrPath ) , "projects" ) ) ; }
Get a Pager of projects belonging to the specified group ID .
72
13
158,049
public Group getGroup ( Object groupIdOrPath ) throws GitLabApiException { Response response = get ( Response . Status . OK , null , "groups" , getGroupIdOrPath ( groupIdOrPath ) ) ; return ( response . readEntity ( Group . class ) ) ; }
Get all details of a group .
62
7
158,050
public Optional < Group > getOptionalGroup ( Object groupIdOrPath ) { try { return ( Optional . ofNullable ( getGroup ( groupIdOrPath ) ) ) ; } catch ( GitLabApiException glae ) { return ( GitLabApi . createOptionalFromException ( glae ) ) ; } }
Get all details of a group as an Optional instance .
68
11
158,051
public void deleteGroup ( Object groupIdOrPath ) throws GitLabApiException { Response . Status expectedStatus = ( isApiVersion ( ApiVersion . V3 ) ? Response . Status . OK : Response . Status . NO_CONTENT ) ; delete ( expectedStatus , null , "groups" , getGroupIdOrPath ( groupIdOrPath ) ) ; }
Removes group with all projects inside .
79
8
158,052
public List < Member > getMembers ( Object groupIdOrPath ) throws GitLabApiException { return ( getMembers ( groupIdOrPath , getDefaultPerPage ( ) ) . all ( ) ) ; }
Get a list of group members viewable by the authenticated user .
45
13
158,053
public List < Member > getMembers ( Object groupIdOrPath , int page , int perPage ) throws GitLabApiException { Response response = get ( Response . Status . OK , getPageQueryParams ( page , perPage ) , "groups" , getGroupIdOrPath ( groupIdOrPath ) , "members" ) ; return ( response . readEntity ( new GenericType < List < Member > > ( ) { } ) ) ; }
Get a list of group members viewable by the authenticated user in the specified page range .
96
18
158,054
public Pager < Member > getMembers ( Object groupIdOrPath , int itemsPerPage ) throws GitLabApiException { return ( new Pager < Member > ( this , Member . class , itemsPerPage , null , "groups" , getGroupIdOrPath ( groupIdOrPath ) , "members" ) ) ; }
Get a Pager of group members viewable by the authenticated user .
71
14
158,055
public Stream < Member > getMembersStream ( Object groupIdOrPath ) throws GitLabApiException { return ( getMembers ( groupIdOrPath , getDefaultPerPage ( ) ) . stream ( ) ) ; }
Get a Stream of group members viewable by the authenticated user .
46
13
158,056
public Member getMember ( Object groupIdOrPath , int userId ) throws GitLabApiException { Response response = get ( Response . Status . OK , getDefaultPerPageParam ( ) , "groups" , getGroupIdOrPath ( groupIdOrPath ) , "members" , userId ) ; return ( response . readEntity ( new GenericType < Member > ( ) { } ) ) ; }
Get a group member viewable by the authenticated user .
86
11
158,057
public Optional < Member > getOptionalMember ( Object groupIdOrPath , int userId ) { try { return ( Optional . ofNullable ( getMember ( groupIdOrPath , userId ) ) ) ; } catch ( GitLabApiException glae ) { return ( GitLabApi . createOptionalFromException ( glae ) ) ; } }
Get a group member viewable by the authenticated user as an Optional instance .
75
15
158,058
public void removeMember ( Object groupIdOrPath , Integer userId ) throws GitLabApiException { Response . Status expectedStatus = ( isApiVersion ( ApiVersion . V3 ) ? Response . Status . OK : Response . Status . NO_CONTENT ) ; delete ( expectedStatus , null , "groups" , getGroupIdOrPath ( groupIdOrPath ) , "members" , userId ) ; }
Removes member from the group .
90
7
158,059
public void ldapSync ( Object groupIdOrPath ) throws GitLabApiException { post ( Response . Status . NO_CONTENT , ( Form ) null , "groups" , getGroupIdOrPath ( groupIdOrPath ) , "ldap_sync" ) ; }
Syncs the group with its linked LDAP group . Only available to group owners and administrators .
61
19
158,060
public void deleteLdapGroupLink ( Object groupIdOrPath , String cn ) throws GitLabApiException { if ( cn == null || cn . trim ( ) . isEmpty ( ) ) { throw new RuntimeException ( "cn cannot be null or empty" ) ; } delete ( Response . Status . OK , null , "groups" , getGroupIdOrPath ( groupIdOrPath ) , "ldap_group_links" , cn ) ; }
Deletes an LDAP group link .
102
8
158,061
public void deleteLdapGroupLink ( Object groupIdOrPath , String cn , String provider ) throws GitLabApiException { if ( cn == null || cn . trim ( ) . isEmpty ( ) ) { throw new RuntimeException ( "cn cannot be null or empty" ) ; } if ( provider == null || provider . trim ( ) . isEmpty ( ) ) { throw new RuntimeException ( "LDAP provider cannot be null or empty" ) ; } delete ( Response . Status . OK , null , "groups" , getGroupIdOrPath ( groupIdOrPath ) , "ldap_group_links" , provider , cn ) ; }
Deletes an LDAP group link for a specific LDAP provider .
143
14
158,062
public List < Variable > getVariables ( Object groupIdOrPath , int page , int perPage ) throws GitLabApiException { Response response = get ( Response . Status . OK , getPageQueryParams ( page , perPage ) , "groups" , getGroupIdOrPath ( groupIdOrPath ) , "variables" ) ; return ( response . readEntity ( new GenericType < List < Variable > > ( ) { } ) ) ; }
Get a list of variables for the specified group in the specified page range .
98
15
158,063
public Pager < Variable > getVariables ( Object groupIdOrPath , int itemsPerPage ) throws GitLabApiException { return ( new Pager < Variable > ( this , Variable . class , itemsPerPage , null , "groups" , getGroupIdOrPath ( groupIdOrPath ) , "variables" ) ) ; }
Get a Pager of variables belonging to the specified group .
73
12
158,064
public Stream < Variable > getVariablesStream ( Object groupIdOrPath ) throws GitLabApiException { return ( getVariables ( groupIdOrPath , getDefaultPerPage ( ) ) . stream ( ) ) ; }
Get a Stream of variables belonging to the specified group .
48
11
158,065
public Variable getVariable ( Object groupIdOrPath , String key ) throws GitLabApiException { Response response = get ( Response . Status . OK , null , "groups" , getGroupIdOrPath ( groupIdOrPath ) , "variables" , key ) ; return ( response . readEntity ( Variable . class ) ) ; }
Get the details of a group variable .
72
8
158,066
public Optional < Variable > getOptionalVariable ( Object groupIdOrPath , String key ) { try { return ( Optional . ofNullable ( getVariable ( groupIdOrPath , key ) ) ) ; } catch ( GitLabApiException glae ) { return ( GitLabApi . createOptionalFromException ( glae ) ) ; } }
Get the details of a group variable as an Optional instance .
73
12
158,067
public Variable createVariable ( Object groupIdOrPath , String key , String value , Boolean isProtected ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "key" , key , true ) . withParam ( "value" , value , true ) . withParam ( "protected" , isProtected ) ; Response response = post ( Response . Status . CREATED , formData , "groups" , getGroupIdOrPath ( groupIdOrPath ) , "variables" ) ; return ( response . readEntity ( Variable . class ) ) ; }
Create a new group variable .
133
6
158,068
public void deleteVariable ( Object groupIdOrPath , String key ) throws GitLabApiException { delete ( Response . Status . NO_CONTENT , null , "groups" , getGroupIdOrPath ( groupIdOrPath ) , "variables" , key ) ; }
Deletes a group variable .
59
6
158,069
public List < Snippet > getSnippets ( boolean downloadContent ) throws GitLabApiException { Response response = get ( Response . Status . OK , getDefaultPerPageParam ( ) , "snippets" ) ; List < Snippet > snippets = ( response . readEntity ( new GenericType < List < Snippet > > ( ) { } ) ) ; if ( downloadContent ) { for ( Snippet snippet : snippets ) { snippet . setContent ( getSnippetContent ( snippet . getId ( ) ) ) ; } } return snippets ; }
Get a list of the authenticated user s snippets .
123
10
158,070
public Pager < Snippet > getSnippets ( int itemsPerPage ) throws GitLabApiException { return ( new Pager < Snippet > ( this , Snippet . class , itemsPerPage , null , "snippets" ) ) ; }
Get a Pager of the authenticated user s snippets .
59
11
158,071
public String getSnippetContent ( Integer snippetId ) throws GitLabApiException { Response response = get ( Response . Status . OK , null , "snippets" , snippetId , "raw" ) ; return ( response . readEntity ( String . class ) ) ; }
Get the content of a Snippet .
60
9
158,072
public Snippet getSnippet ( Integer snippetId , boolean downloadContent ) throws GitLabApiException { if ( snippetId == null ) { throw new RuntimeException ( "snippetId can't be null" ) ; } Response response = get ( Response . Status . OK , null , "snippets" , snippetId ) ; Snippet snippet = response . readEntity ( Snippet . class ) ; if ( downloadContent ) { snippet . setContent ( getSnippetContent ( snippet . getId ( ) ) ) ; } return snippet ; }
Get a specific Snippet .
121
7
158,073
public Optional < Snippet > getOptionalSnippet ( Integer snippetId , boolean downloadContent ) { try { return ( Optional . ofNullable ( getSnippet ( snippetId , downloadContent ) ) ) ; } catch ( GitLabApiException glae ) { return ( GitLabApi . createOptionalFromException ( glae ) ) ; } }
Get a specific snippet as an Optional instance .
77
9
158,074
public Snippet createSnippet ( String title , String fileName , String content ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "title" , title , true ) . withParam ( "file_name" , fileName , true ) . withParam ( "content" , content , true ) ; Response response = post ( Response . Status . CREATED , formData , "snippets" ) ; return ( response . readEntity ( Snippet . class ) ) ; }
Create a new Snippet .
120
7
158,075
public void deleteSnippet ( Integer snippetId ) throws GitLabApiException { if ( snippetId == null ) { throw new RuntimeException ( "snippetId can't be null" ) ; } delete ( Response . Status . NO_CONTENT , null , "snippets" , snippetId ) ; }
Removes Snippet .
68
6
158,076
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 .
80
30
158,077
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 .
56
23
158,078
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 .
103
26
158,079
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 .
79
19
158,080
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 .
102
10
158,081
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 .
78
14
158,082
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 .
138
10
158,083
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 .
84
27
158,084
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 .
110
21
158,085
public Stream < MergeRequest > getMergeRequestsStream ( MergeRequestFilter filter ) throws GitLabApiException { return ( getMergeRequests ( filter , getDefaultPerPage ( ) ) . stream ( ) ) ; }
Get all merge requests matching the filter as a Stream .
49
11
158,086
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 .
60
16
158,087
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 .
85
8
158,088
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 .
84
12
158,089
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 .
92
9
158,090
public Stream < Commit > getCommitsStream ( Object projectIdOrPath , int mergeRequestIid ) throws GitLabApiException { return ( getCommits ( projectIdOrPath , mergeRequestIid , getDefaultPerPage ( ) ) . stream ( ) ) ; }
Get a Stream of merge request commits .
59
8
158,091
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 .
132
67
158,092
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 .
147
7
158,093
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 .
124
7
158,094
public List < Participant > getParticipants ( Object projectIdOrPath , Integer mergeRequestIid ) throws GitLabApiException { return ( getParticipants ( projectIdOrPath , mergeRequestIid , getDefaultPerPage ( ) ) . all ( ) ) ; }
Get list of participants of merge request .
58
8
158,095
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 .
90
11
158,096
public Stream < Participant > getParticipantsStream ( Object projectIdOrPath , Integer mergeRequestIid ) throws GitLabApiException { return ( getParticipants ( projectIdOrPath , mergeRequestIid , getDefaultPerPage ( ) ) . stream ( ) ) ; }
Get Stream of participants of merge request .
59
8
158,097
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 .
62
17
158,098
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 .
94
19
158,099
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 .
63
17