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 .