brapi-java-client/src/main/java/org/brapi/client/v2/BrAPIClient.java
public <T> T handleResponse(Response response, Type returnType) throws ApiException, IOException {
		if (response.isSuccessful()) {
			if (returnType == null || response.code() == 204) {
				// returning null if the returnType is not defined,
				// or the status code is 204 (No Content)
				if (response.body() != null) {
					response.body().close();
				}
				return null;
			} else {
				return deserialize(response, returnType);
			}
		} else {
			String respBody = null;
			if (response.body() != null) {
				try {
					respBody = response.body().string();
				} catch (IOException e) {
					throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap());
				}
			}
			throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody);
		}
	}
/**
	 * Handle the given response, return the deserialized object when the response
	 * is successful.
	 *
	 * @param <T>        Type
	 * @param response   Response
	 * @param returnType Return type
	 * @throws ApiException If the response has a unsuccessful status code or fail
	 *                      to deserialize the response body
	 * @return Type
	 */
Handle the given response, return the deserialized object when the response
is successful.


Handle the given response return the deserialized object when the response is successful .
public <T> T handleResponse(Response response, Type returnType) throws ApiException, IOException {
		if (response.isSuccessful()) {
			if (returnType == null || response.code() == 204) {
				if (response.body() != null) {
					response.body().close();
				}
				return null;
			} else {
				return deserialize(response, returnType);
			}
		} else {
			String respBody = null;
			if (response.body() != null) {
				try {
					respBody = response.body().string();
				} catch (IOException e) {
					throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap());
				}
			}
			throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody);
		}
	}
public < T > T handleResponse ( Response response , Type returnType ) throws ApiException , IOException { if ( response . isSuccessful ( ) ) { if ( returnType == null || response . code ( ) == 204 ) { if ( response . body ( ) != null ) { response . body ( ) . close ( ) ; } return null ; } else { return deserialize ( response , returnType ) ; } } else { String respBody = null ; if ( response . body ( ) != null ) { try { respBody = response . body ( ) . string ( ) ; } catch ( IOException e ) { throw new ApiException ( response . message ( ) , e , response . code ( ) , response . headers ( ) . toMultimap ( ) ) ; } } throw new ApiException ( response . message ( ) , response . code ( ) , response . headers ( ) . toMultimap ( ) , respBody ) ; } }
Handle the given response, return the deserialized object when the response
 is successful.
Handle the given response return the deserialized object when the response is successful .
// returning null if the returnType is not defined, // or the status code is 204 (No Content)