/*
 *   Copyright (C) 2016 Karumi.
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */

package com.karumi.todoapiclient;

import com.karumi.todoapiclient.interceptor.DefaultHeadersInterceptor;
import java.io.IOException;
import okhttp3.OkHttpClient;
import retrofit2.Retrofit;

import static com.karumi.todoapiclient.TodoApiClientConfig.BASE_ENDPOINT;

public class TodoApiClient {

  private final TodoService todoService;

  public TodoApiClient() {
    OkHttpClient okHttpClient = new OkHttpClient();
    okHttpClient.interceptors().add(new DefaultHeadersInterceptor());
    Retrofit retrofit = new Retrofit.Builder().baseUrl(BASE_ENDPOINT).client(okHttpClient).build();
    this.todoService = retrofit.create(TodoService.class);
  }

  public void getAllTasks() {
    try {
      todoService.getAll().execute();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
}

@@ -633,24 +633,330 @@
 apiclient;%0A%0A
+import com.karumi.todoapiclient.dto.TaskDto;%0Aimport com.karumi.todoapiclient.exception.ItemNotFoundException;%0Aimport com.karumi.todoapiclient.exception.NetworkErrorException;%0Aimport com.karumi.todoapiclient.exception.TodoApiClientException;%0Aimport com.karumi.todoapiclient.exception.UnknownErrorException;%0A
 import com.k
@@ -1038,24 +1038,47 @@
 OException;%0A
+import java.util.List;%0A
 import okhtt
@@ -1094,16 +1094,43 @@
 Client;%0A
+import retrofit2.Response;%0A
 import r
@@ -1622,12 +1622,21 @@
 lic 
-void
+List%3CTaskDto%3E
  get
@@ -1650,112 +1650,517 @@
 s() 
-%7B%0A    try %7B%0A      todoService.getAll().execute();%0A    %7D catch (IOException e) %7B%0A      e.printStackTrace(
+throws TodoApiClientException%7B%0A    try %7B%0A      Response%3CList%3CTaskDto%3E%3E response = todoService.getAll().execute();%0A      inspectResponseForErrors(response);%0A      return response.body();%0A    %7D catch (IOException e) %7B%0A      throw new NetworkErrorException();%0A    %7D%0A  %7D%0A%0A  private void inspectResponseForErrors(Response response) throws TodoApiClientException %7B%0A    int code = response.code();%0A    if (code == 404) %7B%0A      throw new ItemNotFoundException();%0A    %7Delse %7B%0A      throw new UnknownErrorException(code
 );%0A 

Add the first method to the todo api client