private JSONObject _request(@NonNull Method m, @NonNull String url, @Nullable Map<String, String> urlParameters, @Nullable String json, @NonNull List<String> hostsArray, int connectTimeout, int readTimeout, @Nullable RequestOptions requestOptions) throws AlgoliaException {
        try {
            return _getJSONObject(_requestRaw(m, url, urlParameters, json, hostsArray, connectTimeout, readTimeout, requestOptions));
        } catch (JSONException e) {
            throw new AlgoliaException("JSON decode error:" + e.getMessage());
        } catch (UnsupportedEncodingException e) {
            throw new AlgoliaException("UTF-8 decode error:" + e.getMessage());
        }
    }
private JSONObject _request(@NonNull Method m, @NonNull String url, @Nullable Map<String, String> urlParameters, @Nullable String json, @NonNull List<String> hostsArray, int connectTimeout, int readTimeout, @Nullable RequestOptions requestOptions) throws AlgoliaException {
        try {
            return _getJSONObject(_requestRaw(m, url, urlParameters, json, hostsArray, connectTimeout, readTimeout, requestOptions));
        } catch (JSONException e) {
            throw new AlgoliaException("JSON decode error:" + e.getMessage());
        } catch (UnsupportedEncodingException e) {
            throw new AlgoliaException("UTF-8 decode error:" + e.getMessage());
        }
    }
private JSONObject _request ( @ NonNull Method m , @ NonNull String url , @ Nullable Map < String , String > urlParameters , @ Nullable String json , @ NonNull List < String > hostsArray , int connectTimeout , int readTimeout , @ Nullable RequestOptions requestOptions ) throws AlgoliaException { try { return _getJSONObject ( _requestRaw ( m , url , urlParameters , json , hostsArray , connectTimeout , readTimeout , requestOptions ) ) ; } catch ( JSONException e ) { throw new AlgoliaException ( "JSON decode error:" + e . getMessage ( ) ) ; } catch ( UnsupportedEncodingException e ) { throw new AlgoliaException ( "UTF-8 decode error:" + e . getMessage ( ) ) ; } }
Send the query according to parameters and returns its result as a JSONObject

@param m              HTTP Method to use
@param url            Endpoint URL, *without query string*. The query string is handled by `urlParameters`.
@param urlParameters  URL parameters
@param json           optional JSON Object to send
@param hostsArray     array of hosts to try successively
@param connectTimeout maximum wait time to open connection
@param readTimeout    maximum time to read data on socket
@return a JSONObject containing the resulting data or error
@throws AlgoliaException if the request data is not valid json
Send the query according to parameters and returns its result as a JSONObject