idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
34,600
public Snippet updateSnippet ( Object projectIdOrPath , Integer snippetId , String title , String filename , String description , String code , Visibility visibility ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "title" , title ) . withParam ( "file_name" , filename ) . withParam ( "description" , description ) . withParam ( "code" , code ) . withParam ( "visibility" , visibility ) ; Response response = put ( Response . Status . OK , formData . asMap ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "snippets" , snippetId ) ; return ( response . readEntity ( Snippet . class ) ) ; }
Updates an existing project snippet . The user must have permission to change an existing snippet .
34,601
public String getRawSnippetContent ( Object projectIdOrPath , Integer snippetId ) throws GitLabApiException { Response response = get ( Response . Status . OK , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "snippets" , snippetId , "raw" ) ; return ( response . readEntity ( String . class ) ) ; }
Get the raw project snippet as plain text .
34,602
public Optional < String > getOptionalRawSnippetContent ( Object projectIdOrPath , Integer snippetId ) { try { return ( Optional . ofNullable ( getRawSnippetContent ( projectIdOrPath , snippetId ) ) ) ; } catch ( GitLabApiException glae ) { return ( GitLabApi . createOptionalFromException ( glae ) ) ; } }
Get the raw project snippet plain text as an Optional instance .
34,603
public void shareProject ( Object projectIdOrPath , Integer groupId , AccessLevel accessLevel , Date expiresAt ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "group_id" , groupId , true ) . withParam ( "group_access" , accessLevel , true ) . withParam ( "expires_at" , expiresAt ) ; post ( Response . Status . CREATED , formData , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "share" ) ; }
Share a project with the specified group .
34,604
public void unshareProject ( Object projectIdOrPath , Integer groupId ) throws GitLabApiException { Response . Status expectedStatus = ( isApiVersion ( ApiVersion . V3 ) ? Response . Status . OK : Response . Status . NO_CONTENT ) ; delete ( expectedStatus , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "share" , groupId ) ; }
Unshare the project from the group .
34,605
public Project archiveProject ( Object projectIdOrPath ) throws GitLabApiException { Response response = post ( Response . Status . CREATED , ( new GitLabApiForm ( ) ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "archive" ) ; return ( response . readEntity ( Project . class ) ) ; }
Archive a project
34,606
public PushRules getPushRules ( Object projectIdOrPath ) throws GitLabApiException { Response response = get ( Response . Status . OK , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "push_rule" ) ; return ( response . readEntity ( PushRules . class ) ) ; }
Get the project s push rules .
34,607
public PushRules createPushRules ( Object projectIdOrPath , PushRules pushRule ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "deny_delete_tag" , pushRule . getDenyDeleteTag ( ) ) . withParam ( "member_check" , pushRule . getMemberCheck ( ) ) . withParam ( "prevent_secrets" , pushRule . getPreventSecrets ( ) ) . withParam ( "commit_message_regex" , pushRule . getCommitMessageRegex ( ) ) . withParam ( "branch_name_regex" , pushRule . getBranchNameRegex ( ) ) . withParam ( "author_email_regex" , pushRule . getAuthorEmailRegex ( ) ) . withParam ( "file_name_regex" , pushRule . getFileNameRegex ( ) ) . withParam ( "max_file_size" , pushRule . getMaxFileSize ( ) ) ; Response response = post ( Response . Status . CREATED , formData , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "push_rule" ) ; return ( response . readEntity ( PushRules . class ) ) ; }
Adds a push rule to a specified project .
34,608
public PushRules updatePushRules ( Object projectIdOrPath , PushRules pushRule ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "deny_delete_tag" , pushRule . getDenyDeleteTag ( ) ) . withParam ( "member_check" , pushRule . getMemberCheck ( ) ) . withParam ( "prevent_secrets" , pushRule . getPreventSecrets ( ) ) . withParam ( "commit_message_regex" , pushRule . getCommitMessageRegex ( ) ) . withParam ( "branch_name_regex" , pushRule . getBranchNameRegex ( ) ) . withParam ( "author_email_regex" , pushRule . getAuthorEmailRegex ( ) ) . withParam ( "file_name_regex" , pushRule . getFileNameRegex ( ) ) . withParam ( "max_file_size" , pushRule . getMaxFileSize ( ) ) ; final Response response = putWithFormData ( Response . Status . OK , formData , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "push_rule" ) ; return ( response . readEntity ( PushRules . class ) ) ; }
Updates a push rule for the specified project .
34,609
public void deletePushRules ( Object projectIdOrPath ) throws GitLabApiException { delete ( Response . Status . OK , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "push_rule" ) ; }
Removes a push rule from a project . This is an idempotent method and can be called multiple times . Either the push rule is available or not .
34,610
public List < Project > getForks ( Object projectIdOrPath ) throws GitLabApiException { return ( getForks ( projectIdOrPath , getDefaultPerPage ( ) ) . all ( ) ) ; }
Get a list of projects that were forked from the specified project .
34,611
public List < Project > getForks ( Object projectIdOrPath , int page , int perPage ) throws GitLabApiException { Response response = get ( Response . Status . OK , getPageQueryParams ( page , perPage ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "forks" ) ; return ( response . readEntity ( new GenericType < List < Project > > ( ) { } ) ) ; }
Get a list of projects that were forked from the specified project and in the specified page range .
34,612
public Pager < Project > getForks ( Object projectIdOrPath , int itemsPerPage ) throws GitLabApiException { return new Pager < Project > ( this , Project . class , itemsPerPage , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "forks" ) ; }
Get a Pager of projects that were forked from the specified project .
34,613
public Stream < Project > getForksStream ( Object projectIdOrPath ) throws GitLabApiException { return ( getForks ( projectIdOrPath , getDefaultPerPage ( ) ) . stream ( ) ) ; }
Get a Stream of projects that were forked from the specified project .
34,614
public Project starProject ( Object projectIdOrPath ) throws GitLabApiException { Response . Status expectedStatus = ( isApiVersion ( ApiVersion . V3 ) ? Response . Status . OK : Response . Status . CREATED ) ; Response response = post ( expectedStatus , ( Form ) null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "star" ) ; return ( response . readEntity ( Project . class ) ) ; }
Star a project .
34,615
public Map < String , Float > getProjectLanguages ( Object projectIdOrPath ) throws GitLabApiException { Response response = get ( Response . Status . OK , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "languages" ) ; return ( response . readEntity ( new GenericType < Map < String , Float > > ( ) { } ) ) ; }
Get languages used in a project with percentage value .
34,616
public Project transferProject ( Object projectIdOrPath , String namespace ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "namespace" , namespace , true ) ; Response response = put ( Response . Status . OK , formData . asMap ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "transfer" ) ; return ( response . readEntity ( Project . class ) ) ; }
Transfer a project to a new namespace . This was added in GitLab 11 . 1
34,617
public Project setProjectAvatar ( Object projectIdOrPath , File avatarFile ) throws GitLabApiException { Response response = putUpload ( Response . Status . OK , "avatar" , avatarFile , "projects" , getProjectIdOrPath ( projectIdOrPath ) ) ; return ( response . readEntity ( Project . class ) ) ; }
Uploads and sets the project avatar for the specified project .
34,618
public List < Variable > getVariables ( Object projectIdOrPath ) throws GitLabApiException { return ( getVariables ( projectIdOrPath , getDefaultPerPage ( ) ) . all ( ) ) ; }
Get list of a project s variables .
34,619
public List < Variable > getVariables ( Object projectIdOrPath , int page , int perPage ) throws GitLabApiException { Response response = get ( Response . Status . OK , getPageQueryParams ( page , perPage ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "variables" ) ; return ( response . readEntity ( new GenericType < List < Variable > > ( ) { } ) ) ; }
Get a list of variables for the specified project in the specified page range .
34,620
public Pager < Variable > getVariables ( Object projectIdOrPath , int itemsPerPage ) throws GitLabApiException { return ( new Pager < Variable > ( this , Variable . class , itemsPerPage , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "variables" ) ) ; }
Get a Pager of variables belonging to the specified project .
34,621
public Stream < Variable > getVariablesStream ( Object projectIdOrPath ) throws GitLabApiException { return ( getVariables ( projectIdOrPath , getDefaultPerPage ( ) ) . stream ( ) ) ; }
Get a Stream of variables belonging to the specified project .
34,622
public Variable getVariable ( Object projectIdOrPath , String key ) throws GitLabApiException { Response response = get ( Response . Status . OK , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "variables" , key ) ; return ( response . readEntity ( Variable . class ) ) ; }
Get the details of a project variable .
34,623
public Variable updateVariable ( Object projectIdOrPath , String key , String value , Boolean isProtected , String environmentScope ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "value" , value , true ) . withParam ( "protected" , isProtected ) . withParam ( "environment_scope" , environmentScope ) ; Response response = putWithFormData ( Response . Status . OK , formData , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "variables" , key ) ; return ( response . readEntity ( Variable . class ) ) ; }
Update a project variable .
34,624
public void deleteVariable ( Object projectIdOrPath , String key ) throws GitLabApiException { delete ( Response . Status . NO_CONTENT , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "variables" , key ) ; }
Deletes a project variable .
34,625
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 .
34,626
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 ( '\n' ) ; dump . append ( "Scheme : " ) . append ( request . getScheme ( ) ) . append ( '\n' ) ; dump . append ( "URI : " ) . append ( request . getRequestURI ( ) ) . append ( '\n' ) ; dump . append ( "Query-String : " ) . append ( request . getQueryString ( ) ) . append ( '\n' ) ; dump . append ( "Auth-Type : " ) . append ( request . getAuthType ( ) ) . append ( '\n' ) ; dump . append ( "Remote-Addr : " ) . append ( request . getRemoteAddr ( ) ) . append ( '\n' ) ; dump . append ( "Scheme : " ) . append ( request . getScheme ( ) ) . append ( '\n' ) ; dump . append ( "Content-Type : " ) . append ( request . getContentType ( ) ) . append ( '\n' ) ; dump . append ( "Content-Length: " ) . append ( request . getContentLength ( ) ) . append ( '\n' ) ; 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 ( '\n' ) ; } } return ( dump . toString ( ) ) ; }
Build a String containing a short multi - line dump of an HTTP request .
34,627
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 ( '\n' ) ; } 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 ( '\n' ) ; } 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 ( '\n' ) ; } 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 .
34,628
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 .
34,629
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 .
34,630
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 .
34,631
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 .
34,632
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 .
34,633
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 .
34,634
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 .
34,635
public WikiPage createPage ( Object projectIdOrPath , String title , String content ) throws GitLabApiException { 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 .
34,636
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 .
34,637
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 .
34,638
public List < ProtectedBranch > getProtectedBranches ( Object projectIdOrPath ) throws GitLabApiException { return ( getProtectedBranches ( projectIdOrPath , this . getDefaultPerPage ( ) ) . all ( ) ) ; }
Gets a list of protected branches from a project .
34,639
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 .
34,640
public Stream < ProtectedBranch > getProtectedBranchesStream ( Object projectIdOrPath ) throws GitLabApiException { return ( getProtectedBranches ( projectIdOrPath , this . getDefaultPerPage ( ) ) . stream ( ) ) ; }
Gets a Stream of protected branches from a project .
34,641
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 .
34,642
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
34,643
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
34,644
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 .
34,645
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 .
34,646
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 .
34,647
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 .
34,648
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 .
34,649
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 .
34,650
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 .
34,651
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 .
34,652
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 .
34,653
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 .
34,654
public NotificationSettings getGlobalNotificationSettings ( ) throws GitLabApiException { Response response = get ( Response . Status . OK , null , "notification_settings" ) ; return ( response . readEntity ( NotificationSettings . class ) ) ; }
Get the global notification settings .
34,655
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 .
34,656
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 .
34,657
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 .
34,658
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,659
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 .
34,660
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 .
34,661
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 .
34,662
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 .
34,663
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 .
34,664
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 .
34,665
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 .
34,666
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 .
34,667
public Stream < Group > getSubGroupsStream ( Object groupIdOrPath ) throws GitLabApiException { return ( getSubGroups ( groupIdOrPath , getDefaultPerPage ( ) ) . stream ( ) ) ; }
Get a Stream of visible direct subgroups in this group .
34,668
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 .
34,669
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 .
34,670
public List < Project > getProjects ( Object groupIdOrPath ) throws GitLabApiException { return ( getProjects ( groupIdOrPath , getDefaultPerPage ( ) ) . all ( ) ) ; }
Get a list of projects belonging to the specified group ID .
34,671
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 .
34,672
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 .
34,673
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 .
34,674
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 .
34,675
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 .
34,676
public List < Member > getMembers ( Object groupIdOrPath ) throws GitLabApiException { return ( getMembers ( groupIdOrPath , getDefaultPerPage ( ) ) . all ( ) ) ; }
Get a list of group members viewable by the authenticated user .
34,677
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 .
34,678
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 .
34,679
public Stream < Member > getMembersStream ( Object groupIdOrPath ) throws GitLabApiException { return ( getMembers ( groupIdOrPath , getDefaultPerPage ( ) ) . stream ( ) ) ; }
Get a Stream of group members viewable by the authenticated user .
34,680
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 .
34,681
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 .
34,682
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 .
34,683
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 .
34,684
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 .
34,685
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 .
34,686
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 .
34,687
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 .
34,688
public Stream < Variable > getVariablesStream ( Object groupIdOrPath ) throws GitLabApiException { return ( getVariables ( groupIdOrPath , getDefaultPerPage ( ) ) . stream ( ) ) ; }
Get a Stream of variables belonging to the specified group .
34,689
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 .
34,690
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 .
34,691
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 .
34,692
public void deleteVariable ( Object groupIdOrPath , String key ) throws GitLabApiException { delete ( Response . Status . NO_CONTENT , null , "groups" , getGroupIdOrPath ( groupIdOrPath ) , "variables" , key ) ; }
Deletes a group variable .
34,693
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 .
34,694
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 .
34,695
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 .
34,696
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 .
34,697
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 .
34,698
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 .
34,699
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 .