src/main/java/net/leanix/api/common/ApiClient.java
public <T> T deserialize(Response response, GenericType<T> returnType) throws ApiException {
    // Handle file downloading.
    if (returnType.equals(File.class)) {
      @SuppressWarnings("unchecked")
      T file = (T) downloadFileFromResponse(response);
      return file;
    }

    String contentType = null;
    List<Object> contentTypes = response.getHeaders().get("Content-Type");
    if (contentTypes != null && !contentTypes.isEmpty())
      contentType = String.valueOf(contentTypes.get(0));
    if (contentType == null)
      throw new ApiException(500, "missing Content-Type in response");

    return response.readEntity(returnType);
  }
public <T> T deserialize(Response response, GenericType<T> returnType) throws ApiException {
    // Handle file downloading.
    if (returnType.equals(File.class)) {
      @SuppressWarnings("unchecked")
      T file = (T) downloadFileFromResponse(response);
      return file;
    }

    String contentType = null;
    List<Object> contentTypes = response.getHeaders().get("Content-Type");
    if (contentTypes != null && !contentTypes.isEmpty())
      contentType = String.valueOf(contentTypes.get(0));
    if (contentType == null)
      throw new ApiException(500, "missing Content-Type in response");

    return response.readEntity(returnType);
  }
Deserialize response body to Java object according to the Content-Type.