openmrs-android-sdk/src/main/java/com/openmrs/android_sdk/library/api/repository/PatientRepository.java
/**
     * Find patients.
     *
     * @param query    the query
     * @param callback the callback
     */
Find patients.
@param query    the query
@param callback the callback
Find patients . @param query the query @param callback the callback
public void findPatients(String query, PatientResponseCallback callback) {
        Call<Results<Patient>> call = restApi.getPatients(query, ApplicationConstants.API.FULL);
        call.enqueue(new Callback<Results<Patient>>() {
            @Override
            public void onResponse(@NonNull Call<Results<Patient>> call, @NonNull Response<Results<Patient>> response) {
                if (callback != null) {
                    if (response.isSuccessful()) {
                        callback.onResponse(response.body());
                    } else {
                        callback.onErrorResponse(response.message());
                    }
                }
            }
            @Override
            public void onFailure(@NonNull Call<Results<Patient>> call, @NonNull Throwable t) {
                callback.onErrorResponse(t.getMessage());
            }
        });
    }
public void findPatients ( String query , PatientResponseCallback callback ) { Call < Results < Patient > > call = restApi . getPatients ( query , ApplicationConstants . API . FULL ) ; call . enqueue ( new Callback < Results < Patient > > ( ) { @ Override public void onResponse ( @ NonNull Call < Results < Patient > > call , @ NonNull Response < Results < Patient > > response ) { if ( callback != null ) { if ( response . isSuccessful ( ) ) { callback . onResponse ( response . body ( ) ) ; } else { callback . onErrorResponse ( response . message ( ) ) ; } } } @ Override public void onFailure ( @ NonNull Call < Results < Patient > > call , @ NonNull Throwable t ) { callback . onErrorResponse ( t . getMessage ( ) ) ; } } ) ; }
Find patients.
Find patients .