// Path: app/src/main/java/com/gisgraphy/domain/valueobject/GeoNamesDto.java
// public class GeoNamesDto {
// 
//     public GeoNamesAddressDto[] geonames;
// 
//     public GeoNamesAddressDto[] getResult() {
//         return geonames;
//     }
// }


import android.content.Context;
import android.location.Address;
import com.gisgraphy.domain.valueobject.GeoNamesDto;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
     * @param maxResults max number of addresses to return. Smaller numbers (1 to 5)
     *                   are recommended
     * @return a list of Address objects. Returns empty list if no matches were
     * found or there is no backend service available.
     * @throws IllegalArgumentException if latitude is less than -90 or greater than 90
     * @throws IllegalArgumentException if longitude is less than -180 or greater than 180
     * @throws IOException              if the network is unavailable or any other I/O problem occurs
     */
    public List<Address> getFromLocation(double latitude, double longitude, int maxResults) throws IOException {

        if (maxResults < 0) {
            throw new IllegalArgumentException("maxResults should be positive");
        }
        if (maxResults == 0) {
            // shortcut filtering
            return new ArrayList<Address>();
        }
        List<Address> androidAddresses = new ArrayList<Address>();
        try {
            RestClient webService = createRestClient();

            // Pass the parameters if needed , if not then pass dummy one as
            // follows
            Map<String, String> params = new HashMap<String, String>();

            // params.put(COUNTRY_PARAMETER_NAME, iso2countryCode);
            params.put(LATITUDE_PARAMETER_NAME, latitude + "");
            params.put(LONGITUDE_PARAMETER_NAME, longitude + "");
            params.put(USERNAME_PARAMETER_NAME, "subvii");

// Path: app/src/main/java/com/gisgraphy/domain/valueobject/GeoNamesDto.java
// public class GeoNamesDto {
// 
//     public GeoNamesAddressDto[] geonames;
// 
//     public GeoNamesAddressDto[] getResult() {
//         return geonames;
//     }
// }


// Path: app/src/main/java/com/gisgraphy/gishraphoid/GeoNamesGeocoder.java
import android.content.Context;
import android.location.Address;
import com.gisgraphy.domain.valueobject.GeoNamesDto;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;

     * @param maxResults max number of addresses to return. Smaller numbers (1 to 5)
     *                   are recommended
     * @return a list of Address objects. Returns empty list if no matches were
     * found or there is no backend service available.
     * @throws IllegalArgumentException if latitude is less than -90 or greater than 90
     * @throws IllegalArgumentException if longitude is less than -180 or greater than 180
     * @throws IOException              if the network is unavailable or any other I/O problem occurs
     */
    public List<Address> getFromLocation(double latitude, double longitude, int maxResults) throws IOException {

        if (maxResults < 0) {
            throw new IllegalArgumentException("maxResults should be positive");
        }
        if (maxResults == 0) {
            // shortcut filtering
            return new ArrayList<Address>();
        }
        List<Address> androidAddresses = new ArrayList<Address>();
        try {
            RestClient webService = createRestClient();

            // Pass the parameters if needed , if not then pass dummy one as
            // follows
            Map<String, String> params = new HashMap<String, String>();

            // params.put(COUNTRY_PARAMETER_NAME, iso2countryCode);
            params.put(LATITUDE_PARAMETER_NAME, latitude + "");
            params.put(LONGITUDE_PARAMETER_NAME, longitude + "");
            params.put(USERNAME_PARAMETER_NAME, "subvii");

            GeoNamesDto response = webService.get(REVERSE_GEOCODING_URI, GeoNamesDto.class, params);