@@ -42,21 +42,20 @@ public TasksApi(Credentials credentials, ClientConfig clientConfig) {
4242 * </ul>
4343 */
4444 public ResponseList <Task > listTasks (Long projectId , Integer limit , Integer offset , Status status , Integer assigneeId ) throws HttpException , HttpBadRequestException {
45- EnumSet <Status > statuses = (status != null ) ? EnumSet .of (status ) : null ;
46-
47- ListTasksParams params = new ListTasksParams ();
48- params .setStatuses (statuses );
49- params .setLimit (limit );
50- params .setOffset (offset );
51- params .setAssigneeId (assigneeId );
52-
53- return listTasksInternal (projectId , params );
45+ Map <String , Optional <Object >> queryParams = HttpRequestConfig .buildUrlParams (
46+ "status" , Optional .ofNullable (status != null ? status .to (status ) : null ),
47+ "assigneeId" , Optional .ofNullable (assigneeId ),
48+ "limit" , Optional .ofNullable (limit ),
49+ "offset" , Optional .ofNullable (offset )
50+ );
51+ TaskResponseList taskResponseList = this .httpClient .get (this .url + "/projects/" + projectId + "/tasks" , new HttpRequestConfig (queryParams ), TaskResponseList .class );
52+ return TaskResponseList .to (taskResponseList );
5453 }
5554
5655 /**
5756 * Lists tasks for a given project, filtered by multiple statuses.
5857 *
59- * @param projectId ID of the project
58+ * @param projectId identifier
6059 * @param params Query params
6160 * @return List of tasks
6261 * @see <ul>
@@ -65,7 +64,28 @@ public ResponseList<Task> listTasks(Long projectId, Integer limit, Integer offse
6564 * </ul>
6665 */
6766 public ResponseList <Task > listTasks (Long projectId , ListTasksParams params ) throws HttpException , HttpBadRequestException {
68- return listTasksInternal (projectId , params );
67+ ListTasksParams query = Optional .ofNullable (params ).orElse (new ListTasksParams ());
68+
69+ EnumSet <Status > statuses = query .getStatuses ();
70+
71+ Map <String , Optional <Object >> queryParams = HttpRequestConfig .buildUrlParams (
72+ "status" , Optional .ofNullable (
73+ statuses == null ? null : statuses .stream ()
74+ .map (status -> status .to (status ))
75+ .collect (Collectors .joining ("," ))
76+ ),
77+ "assigneeId" , Optional .ofNullable (query .getAssigneeId ()),
78+ "limit" , Optional .ofNullable (query .getLimit ()),
79+ "offset" , Optional .ofNullable (query .getOffset ())
80+ );
81+
82+ TaskResponseList taskResponseList = this .httpClient .get (
83+ this .url + "/projects/" + projectId + "/tasks" ,
84+ new HttpRequestConfig (queryParams ),
85+ TaskResponseList .class
86+ );
87+
88+ return TaskResponseList .to (taskResponseList );
6989 }
7090
7191 /**
@@ -177,34 +197,6 @@ public ResponseObject<Task> editTaskArchivedStatus(Long taskId, Long projectId,
177197 return ResponseObject .of (taskResponseObject .getData ());
178198 }
179199
180- //<editor-fold desc="List Tasks Common Method">
181- private ResponseList <Task > listTasksInternal (Long projectId , ListTasksParams params ) throws HttpException , HttpBadRequestException {
182- ListTasksParams query = Optional .ofNullable (params ).orElse (new ListTasksParams ());
183-
184- EnumSet <Status > statuses = query .getStatuses ();
185-
186- Map <String , Optional <Object >> queryParams = HttpRequestConfig .buildUrlParams (
187- "status" , Optional .ofNullable (
188- statuses == null ? null : statuses .stream ()
189- .map (status -> status .to (status ))
190- .collect (Collectors .joining ("," ))
191- ),
192- "assigneeId" , Optional .ofNullable (query .getAssigneeId ()),
193- "limit" , Optional .ofNullable (query .getLimit ()),
194- "offset" , Optional .ofNullable (query .getOffset ())
195- );
196-
197- TaskResponseList taskResponseList = this .httpClient .get (
198- this .url + "/projects/" + projectId + "/tasks" ,
199- new HttpRequestConfig (queryParams ),
200- TaskResponseList .class
201- );
202-
203- return TaskResponseList .to (taskResponseList );
204- }
205-
206- //</editor-fold>
207-
208200 //<editor-fold desc="Task Settings Templates">
209201
210202 /**
0 commit comments