11package org .gitlab4j .api ;
22
3- import org . gitlab4j . api . models . Label ;
3+ import java . util . List ;
44
55import javax .ws .rs .core .GenericType ;
66import javax .ws .rs .core .Response ;
7- import java .util .List ;
7+
8+ import org .gitlab4j .api .models .Label ;
89
910public class LabelsApi extends AbstractApi {
1011 public LabelsApi (GitLabApi gitLabApi ) {
1112 super (gitLabApi );
1213 }
1314
1415 public List <Label > getLabels (Integer projectId ) throws GitLabApiException {
16+
1517 if (projectId == null ) {
1618 throw new RuntimeException ("projectId cannot be null" );
1719 }
20+
1821 Response response = get (javax .ws .rs .core .Response .Status .OK , getDefaultPerPageParam (), "projects" , projectId , "labels" );
1922 return (response .readEntity (new GenericType <List <Label >>() {
2023 }));
2124 }
2225
2326 public List <Label > getLabels (Integer projectId , int page , int perPage ) throws GitLabApiException {
27+
2428 if (projectId == null ) {
2529 throw new RuntimeException ("projectId cannot be null" );
2630 }
27- Response response = get (javax .ws .rs .core .Response .Status .OK , getPageQueryParams (page , perPage ), "projects" , projectId , "labels" );
31+
32+ Response response = get (javax .ws .rs .core .Response .Status .OK , getPageQueryParams (page , perPage ), "projects" , projectId , "labels" );
2833 return (response .readEntity (new GenericType <List <Label >>() {
2934 }));
3035 }
@@ -42,10 +47,12 @@ public Label createLabel(Integer projectId, String name, String color, Integer p
4247 }
4348
4449 public Label createLabel (Integer projectId , String name , String color , String description , Integer priority ) throws GitLabApiException {
45- if (projectId == null ) {
50+
51+ if (projectId == null ) {
4652 throw new RuntimeException ("projectId cannot be null" );
4753 }
48- GitLabApiForm formData = new GitLabApiForm ()
54+
55+ GitLabApiForm formData = new GitLabApiForm ()
4956 .withParam ("name" , name , true )
5057 .withParam ("color" , color , true )
5158 .withParam ("description" , description )
@@ -63,9 +70,11 @@ public Label updateLabelColor(Integer projectId, String name, String color, Stri
6370 }
6471
6572 public Label updateLabel (Integer projectId , String name , String newName , String color , String description , Integer priority ) throws GitLabApiException {
73+
6674 if (projectId == null ) {
6775 throw new RuntimeException ("projectId cannot be null" );
6876 }
77+
6978 GitLabApiForm formData = new GitLabApiForm ()
7079 .withParam ("name" , name , true )
7180 .withParam ("new_name" , newName )
@@ -77,9 +86,11 @@ public Label updateLabel(Integer projectId, String name, String newName, String
7786 }
7887
7988 public void deleteLabel (Integer projectId , String name ) throws GitLabApiException {
89+
8090 if (projectId == null ) {
8191 throw new RuntimeException ("projectId cannot be null" );
8292 }
93+
8394 GitLabApiForm formData = new GitLabApiForm ()
8495 .withParam ("name" , name , true );
8596 Response .Status expectedStatus = (isApiVersion (GitLabApi .ApiVersion .V3 ) ? Response .Status .OK : Response .Status .NO_CONTENT );
0 commit comments