com.wirefreethought.geodb.client.GeoApi Maven / Gradle / Ivy
/*
* GeoDB API
* The GeoDB API focuses on getting global city and region data. Easily obtain country, region, and city data for use in your apps! - Filter cities by name prefix, country, location, time-zone, and even minimum population.
- Sort cities by name, country code, elevation, and population - or any combination of these.
- Get all country regions.
- Get all cities in a given region.
- Display results in multiple languages (currently, English, French, German, Russian, and Spanish).
- RESTful API adheres to industry best-practices, including HATEOAS-style links to facilitate paging results.
- Backed by cloud-based load-balanced infrastructure for resiliency and performance!
- Data is periodically refreshed from GeoNames and WikiData.
Notes:
- All endpoints implicitly support JSONP-style invocation via an optional callback param.
- Since the database is periodically updated, this may very rarely result in certain cities being marked deleted (e.g., duplicates removed). By default, endpoints returning city data will exclude cities marked deleted. However, in the unlikely event that this occurs while your app is paging through a set of affected results - and you care about the paged results suddenly changing underneath - specify includeDeleted=SINCE_YESTERDAY (or SINCE_LAST_WEEK if you're really paranoid!).
Useful Resources
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package com.wirefreethought.geodb.client;
import com.wirefreethought.geodb.client.net.ApiCallback;
import com.wirefreethought.geodb.client.net.ApiClient;
import com.wirefreethought.geodb.client.net.ApiException;
import com.wirefreethought.geodb.client.net.ApiResponse;
import com.wirefreethought.geodb.client.net.Configuration;
import com.wirefreethought.geodb.client.net.Pair;
import com.wirefreethought.geodb.client.net.ProgressRequestBody;
import com.wirefreethought.geodb.client.net.ProgressResponseBody;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import com.wirefreethought.geodb.client.model.CitiesResponse;
import com.wirefreethought.geodb.client.model.CityResponse;
import com.wirefreethought.geodb.client.model.CountriesResponse;
import com.wirefreethought.geodb.client.model.CountryResponse;
import com.wirefreethought.geodb.client.model.DateTimeResponse;
import com.wirefreethought.geodb.client.model.DistanceResponse;
import com.wirefreethought.geodb.client.model.RegionResponse;
import com.wirefreethought.geodb.client.model.RegionsResponse;
import com.wirefreethought.geodb.client.model.TimeResponse;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class GeoApi {
private ApiClient apiClient;
public GeoApi() {
this(Configuration.getDefaultApiClient());
}
public GeoApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Build call for findCitiesNearCityUsingGET
* @param cityId The city id (either native 'id' or 'wikiDataId') (required)
* @param minPopulation Only cities having at least this population (optional)
* @param radius The location radius within which to find cities (optional)
* @param distanceUnit The unit of distance: MI | KM (optional, default to MI)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param limit The maximum number of results to retrieve (optional, default to 10)
* @param offset The zero-ary offset index into the results (optional, default to 0)
* @param sort How to sort the results. Format: ±SORT_FIELD,±SORT_FIELD where SORT_FIELD = countryCode | elevation | name | population (optional)
* @param includeDeleted Whether to include any cities marked deleted: ALL | SINCE_YESTERDAY | SINCE_LAST_WEEK | NONE (optional, default to NONE)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call findCitiesNearCityUsingGETCall(String cityId, Integer minPopulation, Integer radius, String distanceUnit, Boolean asciiMode, String languageCode, Integer limit, Integer offset, String sort, String includeDeleted, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/geo/cities/{cityId}/nearbyCities"
.replaceAll("\\{" + "cityId" + "\\}", apiClient.escapeString(cityId.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (minPopulation != null)
localVarQueryParams.addAll(apiClient.parameterToPair("minPopulation", minPopulation));
if (radius != null)
localVarQueryParams.addAll(apiClient.parameterToPair("radius", radius));
if (distanceUnit != null)
localVarQueryParams.addAll(apiClient.parameterToPair("distanceUnit", distanceUnit));
if (asciiMode != null)
localVarQueryParams.addAll(apiClient.parameterToPair("asciiMode", asciiMode));
if (languageCode != null)
localVarQueryParams.addAll(apiClient.parameterToPair("languageCode", languageCode));
if (limit != null)
localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit));
if (offset != null)
localVarQueryParams.addAll(apiClient.parameterToPair("offset", offset));
if (sort != null)
localVarQueryParams.addAll(apiClient.parameterToPair("sort", sort));
if (includeDeleted != null)
localVarQueryParams.addAll(apiClient.parameterToPair("includeDeleted", includeDeleted));
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "UserSecurity" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call findCitiesNearCityUsingGETValidateBeforeCall(String cityId, Integer minPopulation, Integer radius, String distanceUnit, Boolean asciiMode, String languageCode, Integer limit, Integer offset, String sort, String includeDeleted, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'cityId' is set
if (cityId == null) {
throw new ApiException("Missing the required parameter 'cityId' when calling findCitiesNearCityUsingGET(Async)");
}
com.squareup.okhttp.Call call = findCitiesNearCityUsingGETCall(cityId, minPopulation, radius, distanceUnit, asciiMode, languageCode, limit, offset, sort, includeDeleted, progressListener, progressRequestListener);
return call;
}
/**
* Find cities near city
* Find cities near the given origin city, filtering by optional criteria. If no criteria are set, you will get back all known cities.
* @param cityId The city id (either native 'id' or 'wikiDataId') (required)
* @param minPopulation Only cities having at least this population (optional)
* @param radius The location radius within which to find cities (optional)
* @param distanceUnit The unit of distance: MI | KM (optional, default to MI)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param limit The maximum number of results to retrieve (optional, default to 10)
* @param offset The zero-ary offset index into the results (optional, default to 0)
* @param sort How to sort the results. Format: ±SORT_FIELD,±SORT_FIELD where SORT_FIELD = countryCode | elevation | name | population (optional)
* @param includeDeleted Whether to include any cities marked deleted: ALL | SINCE_YESTERDAY | SINCE_LAST_WEEK | NONE (optional, default to NONE)
* @return CitiesResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public CitiesResponse findCitiesNearCityUsingGET(String cityId, Integer minPopulation, Integer radius, String distanceUnit, Boolean asciiMode, String languageCode, Integer limit, Integer offset, String sort, String includeDeleted) throws ApiException {
ApiResponse resp = findCitiesNearCityUsingGETWithHttpInfo(cityId, minPopulation, radius, distanceUnit, asciiMode, languageCode, limit, offset, sort, includeDeleted);
return resp.getData();
}
/**
* Find cities near city
* Find cities near the given origin city, filtering by optional criteria. If no criteria are set, you will get back all known cities.
* @param cityId The city id (either native 'id' or 'wikiDataId') (required)
* @param minPopulation Only cities having at least this population (optional)
* @param radius The location radius within which to find cities (optional)
* @param distanceUnit The unit of distance: MI | KM (optional, default to MI)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param limit The maximum number of results to retrieve (optional, default to 10)
* @param offset The zero-ary offset index into the results (optional, default to 0)
* @param sort How to sort the results. Format: ±SORT_FIELD,±SORT_FIELD where SORT_FIELD = countryCode | elevation | name | population (optional)
* @param includeDeleted Whether to include any cities marked deleted: ALL | SINCE_YESTERDAY | SINCE_LAST_WEEK | NONE (optional, default to NONE)
* @return ApiResponse<CitiesResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse findCitiesNearCityUsingGETWithHttpInfo(String cityId, Integer minPopulation, Integer radius, String distanceUnit, Boolean asciiMode, String languageCode, Integer limit, Integer offset, String sort, String includeDeleted) throws ApiException {
com.squareup.okhttp.Call call = findCitiesNearCityUsingGETValidateBeforeCall(cityId, minPopulation, radius, distanceUnit, asciiMode, languageCode, limit, offset, sort, includeDeleted, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Find cities near city (asynchronously)
* Find cities near the given origin city, filtering by optional criteria. If no criteria are set, you will get back all known cities.
* @param cityId The city id (either native 'id' or 'wikiDataId') (required)
* @param minPopulation Only cities having at least this population (optional)
* @param radius The location radius within which to find cities (optional)
* @param distanceUnit The unit of distance: MI | KM (optional, default to MI)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param limit The maximum number of results to retrieve (optional, default to 10)
* @param offset The zero-ary offset index into the results (optional, default to 0)
* @param sort How to sort the results. Format: ±SORT_FIELD,±SORT_FIELD where SORT_FIELD = countryCode | elevation | name | population (optional)
* @param includeDeleted Whether to include any cities marked deleted: ALL | SINCE_YESTERDAY | SINCE_LAST_WEEK | NONE (optional, default to NONE)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call findCitiesNearCityUsingGETAsync(String cityId, Integer minPopulation, Integer radius, String distanceUnit, Boolean asciiMode, String languageCode, Integer limit, Integer offset, String sort, String includeDeleted, final ApiCallback callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = findCitiesNearCityUsingGETValidateBeforeCall(cityId, minPopulation, radius, distanceUnit, asciiMode, languageCode, limit, offset, sort, includeDeleted, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for findCitiesNearLocationUsingGET
* @param locationId Only cities near this location. Latitude/longitude in ISO-6709 format: ±DD.DDDD±DDD.DDDD (required)
* @param minPopulation Only cities having at least this population (optional)
* @param radius The location radius within which to find cities (optional)
* @param distanceUnit The unit of distance: MI | KM (optional, default to MI)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param limit The maximum number of results to retrieve (optional, default to 5)
* @param offset The zero-ary offset index into the results (optional, default to 0)
* @param sort How to sort the results. Format: ±SORT_FIELD,±SORT_FIELD where SORT_FIELD = countryCode | elevation | name | population (optional)
* @param includeDeleted Whether to include any cities marked deleted: ALL | SINCE_YESTERDAY | SINCE_LAST_WEEK | NONE (optional, default to NONE)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call findCitiesNearLocationUsingGETCall(String locationId, Integer minPopulation, Integer radius, String distanceUnit, Boolean asciiMode, String languageCode, Integer limit, Integer offset, String sort, String includeDeleted, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/geo/locations/{locationId}/nearbyCities"
.replaceAll("\\{" + "locationId" + "\\}", apiClient.escapeString(locationId.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (minPopulation != null)
localVarQueryParams.addAll(apiClient.parameterToPair("minPopulation", minPopulation));
if (radius != null)
localVarQueryParams.addAll(apiClient.parameterToPair("radius", radius));
if (distanceUnit != null)
localVarQueryParams.addAll(apiClient.parameterToPair("distanceUnit", distanceUnit));
if (asciiMode != null)
localVarQueryParams.addAll(apiClient.parameterToPair("asciiMode", asciiMode));
if (languageCode != null)
localVarQueryParams.addAll(apiClient.parameterToPair("languageCode", languageCode));
if (limit != null)
localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit));
if (offset != null)
localVarQueryParams.addAll(apiClient.parameterToPair("offset", offset));
if (sort != null)
localVarQueryParams.addAll(apiClient.parameterToPair("sort", sort));
if (includeDeleted != null)
localVarQueryParams.addAll(apiClient.parameterToPair("includeDeleted", includeDeleted));
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "UserSecurity" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call findCitiesNearLocationUsingGETValidateBeforeCall(String locationId, Integer minPopulation, Integer radius, String distanceUnit, Boolean asciiMode, String languageCode, Integer limit, Integer offset, String sort, String includeDeleted, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException("Missing the required parameter 'locationId' when calling findCitiesNearLocationUsingGET(Async)");
}
com.squareup.okhttp.Call call = findCitiesNearLocationUsingGETCall(locationId, minPopulation, radius, distanceUnit, asciiMode, languageCode, limit, offset, sort, includeDeleted, progressListener, progressRequestListener);
return call;
}
/**
* Find cities near location
* Find cities near the given location, filtering by optional criteria. If no criteria are set, you will get back all known cities.
* @param locationId Only cities near this location. Latitude/longitude in ISO-6709 format: ±DD.DDDD±DDD.DDDD (required)
* @param minPopulation Only cities having at least this population (optional)
* @param radius The location radius within which to find cities (optional)
* @param distanceUnit The unit of distance: MI | KM (optional, default to MI)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param limit The maximum number of results to retrieve (optional, default to 5)
* @param offset The zero-ary offset index into the results (optional, default to 0)
* @param sort How to sort the results. Format: ±SORT_FIELD,±SORT_FIELD where SORT_FIELD = countryCode | elevation | name | population (optional)
* @param includeDeleted Whether to include any cities marked deleted: ALL | SINCE_YESTERDAY | SINCE_LAST_WEEK | NONE (optional, default to NONE)
* @return CitiesResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public CitiesResponse findCitiesNearLocationUsingGET(String locationId, Integer minPopulation, Integer radius, String distanceUnit, Boolean asciiMode, String languageCode, Integer limit, Integer offset, String sort, String includeDeleted) throws ApiException {
ApiResponse resp = findCitiesNearLocationUsingGETWithHttpInfo(locationId, minPopulation, radius, distanceUnit, asciiMode, languageCode, limit, offset, sort, includeDeleted);
return resp.getData();
}
/**
* Find cities near location
* Find cities near the given location, filtering by optional criteria. If no criteria are set, you will get back all known cities.
* @param locationId Only cities near this location. Latitude/longitude in ISO-6709 format: ±DD.DDDD±DDD.DDDD (required)
* @param minPopulation Only cities having at least this population (optional)
* @param radius The location radius within which to find cities (optional)
* @param distanceUnit The unit of distance: MI | KM (optional, default to MI)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param limit The maximum number of results to retrieve (optional, default to 5)
* @param offset The zero-ary offset index into the results (optional, default to 0)
* @param sort How to sort the results. Format: ±SORT_FIELD,±SORT_FIELD where SORT_FIELD = countryCode | elevation | name | population (optional)
* @param includeDeleted Whether to include any cities marked deleted: ALL | SINCE_YESTERDAY | SINCE_LAST_WEEK | NONE (optional, default to NONE)
* @return ApiResponse<CitiesResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse findCitiesNearLocationUsingGETWithHttpInfo(String locationId, Integer minPopulation, Integer radius, String distanceUnit, Boolean asciiMode, String languageCode, Integer limit, Integer offset, String sort, String includeDeleted) throws ApiException {
com.squareup.okhttp.Call call = findCitiesNearLocationUsingGETValidateBeforeCall(locationId, minPopulation, radius, distanceUnit, asciiMode, languageCode, limit, offset, sort, includeDeleted, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Find cities near location (asynchronously)
* Find cities near the given location, filtering by optional criteria. If no criteria are set, you will get back all known cities.
* @param locationId Only cities near this location. Latitude/longitude in ISO-6709 format: ±DD.DDDD±DDD.DDDD (required)
* @param minPopulation Only cities having at least this population (optional)
* @param radius The location radius within which to find cities (optional)
* @param distanceUnit The unit of distance: MI | KM (optional, default to MI)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param limit The maximum number of results to retrieve (optional, default to 5)
* @param offset The zero-ary offset index into the results (optional, default to 0)
* @param sort How to sort the results. Format: ±SORT_FIELD,±SORT_FIELD where SORT_FIELD = countryCode | elevation | name | population (optional)
* @param includeDeleted Whether to include any cities marked deleted: ALL | SINCE_YESTERDAY | SINCE_LAST_WEEK | NONE (optional, default to NONE)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call findCitiesNearLocationUsingGETAsync(String locationId, Integer minPopulation, Integer radius, String distanceUnit, Boolean asciiMode, String languageCode, Integer limit, Integer offset, String sort, String includeDeleted, final ApiCallback callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = findCitiesNearLocationUsingGETValidateBeforeCall(locationId, minPopulation, radius, distanceUnit, asciiMode, languageCode, limit, offset, sort, includeDeleted, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for findCitiesUsingGET
* @param namePrefix Only cities whose names start with this prefix. If languageCode is set, the prefix will be matched on the name as it appears in that language. (optional)
* @param countryIds Only cities in these countries (comma-delimited country codes or WikiData ids) (optional)
* @param excludedCountryIds Only cities NOT in these countries (comma-delimited country codes or WikiData ids) (optional)
* @param minPopulation Only cities having at least this population (optional)
* @param location Only cities near this location. Latitude/longitude in ISO-6709 format: ±DD.DDDD±DDD.DDDD (optional)
* @param radius The location radius within which to find cities (optional)
* @param distanceUnit The unit of distance: MI | KM (optional, default to MI)
* @param timeZoneIds Only cities in these time-zones (optional)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param limit The maximum number of results to retrieve (optional, default to 10)
* @param offset The zero-ary offset index into the results (optional, default to 0)
* @param sort How to sort the results. Format: ±SORT_FIELD,±SORT_FIELD where SORT_FIELD = countryCode | elevation | name | population (optional)
* @param includeDeleted Whether to include any cities marked deleted: ALL | SINCE_YESTERDAY | SINCE_LAST_WEEK | NONE (optional, default to NONE)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call findCitiesUsingGETCall(String namePrefix, String countryIds, String excludedCountryIds, Integer minPopulation, String location, Integer radius, String distanceUnit, String timeZoneIds, Boolean asciiMode, String languageCode, Integer limit, Integer offset, String sort, String includeDeleted, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/geo/cities";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (namePrefix != null)
localVarQueryParams.addAll(apiClient.parameterToPair("namePrefix", namePrefix));
if (countryIds != null)
localVarQueryParams.addAll(apiClient.parameterToPair("countryIds", countryIds));
if (excludedCountryIds != null)
localVarQueryParams.addAll(apiClient.parameterToPair("excludedCountryIds", excludedCountryIds));
if (minPopulation != null)
localVarQueryParams.addAll(apiClient.parameterToPair("minPopulation", minPopulation));
if (location != null)
localVarQueryParams.addAll(apiClient.parameterToPair("location", location));
if (radius != null)
localVarQueryParams.addAll(apiClient.parameterToPair("radius", radius));
if (distanceUnit != null)
localVarQueryParams.addAll(apiClient.parameterToPair("distanceUnit", distanceUnit));
if (timeZoneIds != null)
localVarQueryParams.addAll(apiClient.parameterToPair("timeZoneIds", timeZoneIds));
if (asciiMode != null)
localVarQueryParams.addAll(apiClient.parameterToPair("asciiMode", asciiMode));
if (languageCode != null)
localVarQueryParams.addAll(apiClient.parameterToPair("languageCode", languageCode));
if (limit != null)
localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit));
if (offset != null)
localVarQueryParams.addAll(apiClient.parameterToPair("offset", offset));
if (sort != null)
localVarQueryParams.addAll(apiClient.parameterToPair("sort", sort));
if (includeDeleted != null)
localVarQueryParams.addAll(apiClient.parameterToPair("includeDeleted", includeDeleted));
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "UserSecurity" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call findCitiesUsingGETValidateBeforeCall(String namePrefix, String countryIds, String excludedCountryIds, Integer minPopulation, String location, Integer radius, String distanceUnit, String timeZoneIds, Boolean asciiMode, String languageCode, Integer limit, Integer offset, String sort, String includeDeleted, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
com.squareup.okhttp.Call call = findCitiesUsingGETCall(namePrefix, countryIds, excludedCountryIds, minPopulation, location, radius, distanceUnit, timeZoneIds, asciiMode, languageCode, limit, offset, sort, includeDeleted, progressListener, progressRequestListener);
return call;
}
/**
* Find cities
* Find cities, filtering by optional criteria. If no criteria are set, you will get back all known cities.
* @param namePrefix Only cities whose names start with this prefix. If languageCode is set, the prefix will be matched on the name as it appears in that language. (optional)
* @param countryIds Only cities in these countries (comma-delimited country codes or WikiData ids) (optional)
* @param excludedCountryIds Only cities NOT in these countries (comma-delimited country codes or WikiData ids) (optional)
* @param minPopulation Only cities having at least this population (optional)
* @param location Only cities near this location. Latitude/longitude in ISO-6709 format: ±DD.DDDD±DDD.DDDD (optional)
* @param radius The location radius within which to find cities (optional)
* @param distanceUnit The unit of distance: MI | KM (optional, default to MI)
* @param timeZoneIds Only cities in these time-zones (optional)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param limit The maximum number of results to retrieve (optional, default to 10)
* @param offset The zero-ary offset index into the results (optional, default to 0)
* @param sort How to sort the results. Format: ±SORT_FIELD,±SORT_FIELD where SORT_FIELD = countryCode | elevation | name | population (optional)
* @param includeDeleted Whether to include any cities marked deleted: ALL | SINCE_YESTERDAY | SINCE_LAST_WEEK | NONE (optional, default to NONE)
* @return CitiesResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public CitiesResponse findCitiesUsingGET(String namePrefix, String countryIds, String excludedCountryIds, Integer minPopulation, String location, Integer radius, String distanceUnit, String timeZoneIds, Boolean asciiMode, String languageCode, Integer limit, Integer offset, String sort, String includeDeleted) throws ApiException {
ApiResponse resp = findCitiesUsingGETWithHttpInfo(namePrefix, countryIds, excludedCountryIds, minPopulation, location, radius, distanceUnit, timeZoneIds, asciiMode, languageCode, limit, offset, sort, includeDeleted);
return resp.getData();
}
/**
* Find cities
* Find cities, filtering by optional criteria. If no criteria are set, you will get back all known cities.
* @param namePrefix Only cities whose names start with this prefix. If languageCode is set, the prefix will be matched on the name as it appears in that language. (optional)
* @param countryIds Only cities in these countries (comma-delimited country codes or WikiData ids) (optional)
* @param excludedCountryIds Only cities NOT in these countries (comma-delimited country codes or WikiData ids) (optional)
* @param minPopulation Only cities having at least this population (optional)
* @param location Only cities near this location. Latitude/longitude in ISO-6709 format: ±DD.DDDD±DDD.DDDD (optional)
* @param radius The location radius within which to find cities (optional)
* @param distanceUnit The unit of distance: MI | KM (optional, default to MI)
* @param timeZoneIds Only cities in these time-zones (optional)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param limit The maximum number of results to retrieve (optional, default to 10)
* @param offset The zero-ary offset index into the results (optional, default to 0)
* @param sort How to sort the results. Format: ±SORT_FIELD,±SORT_FIELD where SORT_FIELD = countryCode | elevation | name | population (optional)
* @param includeDeleted Whether to include any cities marked deleted: ALL | SINCE_YESTERDAY | SINCE_LAST_WEEK | NONE (optional, default to NONE)
* @return ApiResponse<CitiesResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse findCitiesUsingGETWithHttpInfo(String namePrefix, String countryIds, String excludedCountryIds, Integer minPopulation, String location, Integer radius, String distanceUnit, String timeZoneIds, Boolean asciiMode, String languageCode, Integer limit, Integer offset, String sort, String includeDeleted) throws ApiException {
com.squareup.okhttp.Call call = findCitiesUsingGETValidateBeforeCall(namePrefix, countryIds, excludedCountryIds, minPopulation, location, radius, distanceUnit, timeZoneIds, asciiMode, languageCode, limit, offset, sort, includeDeleted, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Find cities (asynchronously)
* Find cities, filtering by optional criteria. If no criteria are set, you will get back all known cities.
* @param namePrefix Only cities whose names start with this prefix. If languageCode is set, the prefix will be matched on the name as it appears in that language. (optional)
* @param countryIds Only cities in these countries (comma-delimited country codes or WikiData ids) (optional)
* @param excludedCountryIds Only cities NOT in these countries (comma-delimited country codes or WikiData ids) (optional)
* @param minPopulation Only cities having at least this population (optional)
* @param location Only cities near this location. Latitude/longitude in ISO-6709 format: ±DD.DDDD±DDD.DDDD (optional)
* @param radius The location radius within which to find cities (optional)
* @param distanceUnit The unit of distance: MI | KM (optional, default to MI)
* @param timeZoneIds Only cities in these time-zones (optional)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param limit The maximum number of results to retrieve (optional, default to 10)
* @param offset The zero-ary offset index into the results (optional, default to 0)
* @param sort How to sort the results. Format: ±SORT_FIELD,±SORT_FIELD where SORT_FIELD = countryCode | elevation | name | population (optional)
* @param includeDeleted Whether to include any cities marked deleted: ALL | SINCE_YESTERDAY | SINCE_LAST_WEEK | NONE (optional, default to NONE)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call findCitiesUsingGETAsync(String namePrefix, String countryIds, String excludedCountryIds, Integer minPopulation, String location, Integer radius, String distanceUnit, String timeZoneIds, Boolean asciiMode, String languageCode, Integer limit, Integer offset, String sort, String includeDeleted, final ApiCallback callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = findCitiesUsingGETValidateBeforeCall(namePrefix, countryIds, excludedCountryIds, minPopulation, location, radius, distanceUnit, timeZoneIds, asciiMode, languageCode, limit, offset, sort, includeDeleted, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for findRegionCitiesUsingGET
* @param countryId An ISO-3166 country code or WikiData id (required)
* @param regionCode An ISO-3166 or FIPS region code (required)
* @param minPopulation Only cities having at least this population (optional)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param limit The maximum number of results to retrieve (optional, default to 10)
* @param offset The zero-ary offset index into the results (optional, default to 0)
* @param sort How to sort the results. Format: ±SORT_FIELD,±SORT_FIELD where SORT_FIELD = elevation | name | population (optional)
* @param includeDeleted Whether to include any cities marked deleted: ALL | SINCE_YESTERDAY | SINCE_LAST_WEEK | NONE (optional, default to NONE)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call findRegionCitiesUsingGETCall(String countryId, String regionCode, Integer minPopulation, Boolean asciiMode, String languageCode, Integer limit, Integer offset, String sort, String includeDeleted, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/geo/countries/{countryId}/regions/{regionCode}/cities"
.replaceAll("\\{" + "countryId" + "\\}", apiClient.escapeString(countryId.toString()))
.replaceAll("\\{" + "regionCode" + "\\}", apiClient.escapeString(regionCode.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (minPopulation != null)
localVarQueryParams.addAll(apiClient.parameterToPair("minPopulation", minPopulation));
if (asciiMode != null)
localVarQueryParams.addAll(apiClient.parameterToPair("asciiMode", asciiMode));
if (languageCode != null)
localVarQueryParams.addAll(apiClient.parameterToPair("languageCode", languageCode));
if (limit != null)
localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit));
if (offset != null)
localVarQueryParams.addAll(apiClient.parameterToPair("offset", offset));
if (sort != null)
localVarQueryParams.addAll(apiClient.parameterToPair("sort", sort));
if (includeDeleted != null)
localVarQueryParams.addAll(apiClient.parameterToPair("includeDeleted", includeDeleted));
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "UserSecurity" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call findRegionCitiesUsingGETValidateBeforeCall(String countryId, String regionCode, Integer minPopulation, Boolean asciiMode, String languageCode, Integer limit, Integer offset, String sort, String includeDeleted, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'countryId' is set
if (countryId == null) {
throw new ApiException("Missing the required parameter 'countryId' when calling findRegionCitiesUsingGET(Async)");
}
// verify the required parameter 'regionCode' is set
if (regionCode == null) {
throw new ApiException("Missing the required parameter 'regionCode' when calling findRegionCitiesUsingGET(Async)");
}
com.squareup.okhttp.Call call = findRegionCitiesUsingGETCall(countryId, regionCode, minPopulation, asciiMode, languageCode, limit, offset, sort, includeDeleted, progressListener, progressRequestListener);
return call;
}
/**
* Find country region cities
* Get the cities in a specific country region. The country and region info is omitted in the response.
* @param countryId An ISO-3166 country code or WikiData id (required)
* @param regionCode An ISO-3166 or FIPS region code (required)
* @param minPopulation Only cities having at least this population (optional)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param limit The maximum number of results to retrieve (optional, default to 10)
* @param offset The zero-ary offset index into the results (optional, default to 0)
* @param sort How to sort the results. Format: ±SORT_FIELD,±SORT_FIELD where SORT_FIELD = elevation | name | population (optional)
* @param includeDeleted Whether to include any cities marked deleted: ALL | SINCE_YESTERDAY | SINCE_LAST_WEEK | NONE (optional, default to NONE)
* @return CitiesResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public CitiesResponse findRegionCitiesUsingGET(String countryId, String regionCode, Integer minPopulation, Boolean asciiMode, String languageCode, Integer limit, Integer offset, String sort, String includeDeleted) throws ApiException {
ApiResponse resp = findRegionCitiesUsingGETWithHttpInfo(countryId, regionCode, minPopulation, asciiMode, languageCode, limit, offset, sort, includeDeleted);
return resp.getData();
}
/**
* Find country region cities
* Get the cities in a specific country region. The country and region info is omitted in the response.
* @param countryId An ISO-3166 country code or WikiData id (required)
* @param regionCode An ISO-3166 or FIPS region code (required)
* @param minPopulation Only cities having at least this population (optional)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param limit The maximum number of results to retrieve (optional, default to 10)
* @param offset The zero-ary offset index into the results (optional, default to 0)
* @param sort How to sort the results. Format: ±SORT_FIELD,±SORT_FIELD where SORT_FIELD = elevation | name | population (optional)
* @param includeDeleted Whether to include any cities marked deleted: ALL | SINCE_YESTERDAY | SINCE_LAST_WEEK | NONE (optional, default to NONE)
* @return ApiResponse<CitiesResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse findRegionCitiesUsingGETWithHttpInfo(String countryId, String regionCode, Integer minPopulation, Boolean asciiMode, String languageCode, Integer limit, Integer offset, String sort, String includeDeleted) throws ApiException {
com.squareup.okhttp.Call call = findRegionCitiesUsingGETValidateBeforeCall(countryId, regionCode, minPopulation, asciiMode, languageCode, limit, offset, sort, includeDeleted, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Find country region cities (asynchronously)
* Get the cities in a specific country region. The country and region info is omitted in the response.
* @param countryId An ISO-3166 country code or WikiData id (required)
* @param regionCode An ISO-3166 or FIPS region code (required)
* @param minPopulation Only cities having at least this population (optional)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param limit The maximum number of results to retrieve (optional, default to 10)
* @param offset The zero-ary offset index into the results (optional, default to 0)
* @param sort How to sort the results. Format: ±SORT_FIELD,±SORT_FIELD where SORT_FIELD = elevation | name | population (optional)
* @param includeDeleted Whether to include any cities marked deleted: ALL | SINCE_YESTERDAY | SINCE_LAST_WEEK | NONE (optional, default to NONE)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call findRegionCitiesUsingGETAsync(String countryId, String regionCode, Integer minPopulation, Boolean asciiMode, String languageCode, Integer limit, Integer offset, String sort, String includeDeleted, final ApiCallback callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = findRegionCitiesUsingGETValidateBeforeCall(countryId, regionCode, minPopulation, asciiMode, languageCode, limit, offset, sort, includeDeleted, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getCityDateTimeUsingGET
* @param cityId The city id (either native 'id' or 'wikiDataId') (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call getCityDateTimeUsingGETCall(String cityId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/geo/cities/{cityId}/dateTime"
.replaceAll("\\{" + "cityId" + "\\}", apiClient.escapeString(cityId.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "UserSecurity" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call getCityDateTimeUsingGETValidateBeforeCall(String cityId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'cityId' is set
if (cityId == null) {
throw new ApiException("Missing the required parameter 'cityId' when calling getCityDateTimeUsingGET(Async)");
}
com.squareup.okhttp.Call call = getCityDateTimeUsingGETCall(cityId, progressListener, progressRequestListener);
return call;
}
/**
* Get city date-time
* Get city date-time
* @param cityId The city id (either native 'id' or 'wikiDataId') (required)
* @return DateTimeResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public DateTimeResponse getCityDateTimeUsingGET(String cityId) throws ApiException {
ApiResponse resp = getCityDateTimeUsingGETWithHttpInfo(cityId);
return resp.getData();
}
/**
* Get city date-time
* Get city date-time
* @param cityId The city id (either native 'id' or 'wikiDataId') (required)
* @return ApiResponse<DateTimeResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getCityDateTimeUsingGETWithHttpInfo(String cityId) throws ApiException {
com.squareup.okhttp.Call call = getCityDateTimeUsingGETValidateBeforeCall(cityId, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get city date-time (asynchronously)
* Get city date-time
* @param cityId The city id (either native 'id' or 'wikiDataId') (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call getCityDateTimeUsingGETAsync(String cityId, final ApiCallback callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getCityDateTimeUsingGETValidateBeforeCall(cityId, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getCityDistanceUsingGET
* @param cityId The city id (either native 'id' or 'wikiDataId') (required)
* @param fromCityId Distance from this city (required)
* @param distanceUnit The unit of distance: MI | KM (optional, default to MI)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call getCityDistanceUsingGETCall(String cityId, String fromCityId, String distanceUnit, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/geo/cities/{cityId}/distance"
.replaceAll("\\{" + "cityId" + "\\}", apiClient.escapeString(cityId.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (fromCityId != null)
localVarQueryParams.addAll(apiClient.parameterToPair("fromCityId", fromCityId));
if (distanceUnit != null)
localVarQueryParams.addAll(apiClient.parameterToPair("distanceUnit", distanceUnit));
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "UserSecurity" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call getCityDistanceUsingGETValidateBeforeCall(String cityId, String fromCityId, String distanceUnit, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'cityId' is set
if (cityId == null) {
throw new ApiException("Missing the required parameter 'cityId' when calling getCityDistanceUsingGET(Async)");
}
// verify the required parameter 'fromCityId' is set
if (fromCityId == null) {
throw new ApiException("Missing the required parameter 'fromCityId' when calling getCityDistanceUsingGET(Async)");
}
com.squareup.okhttp.Call call = getCityDistanceUsingGETCall(cityId, fromCityId, distanceUnit, progressListener, progressRequestListener);
return call;
}
/**
* Get city distance
* Get distance to the given city
* @param cityId The city id (either native 'id' or 'wikiDataId') (required)
* @param fromCityId Distance from this city (required)
* @param distanceUnit The unit of distance: MI | KM (optional, default to MI)
* @return DistanceResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public DistanceResponse getCityDistanceUsingGET(String cityId, String fromCityId, String distanceUnit) throws ApiException {
ApiResponse resp = getCityDistanceUsingGETWithHttpInfo(cityId, fromCityId, distanceUnit);
return resp.getData();
}
/**
* Get city distance
* Get distance to the given city
* @param cityId The city id (either native 'id' or 'wikiDataId') (required)
* @param fromCityId Distance from this city (required)
* @param distanceUnit The unit of distance: MI | KM (optional, default to MI)
* @return ApiResponse<DistanceResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getCityDistanceUsingGETWithHttpInfo(String cityId, String fromCityId, String distanceUnit) throws ApiException {
com.squareup.okhttp.Call call = getCityDistanceUsingGETValidateBeforeCall(cityId, fromCityId, distanceUnit, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get city distance (asynchronously)
* Get distance to the given city
* @param cityId The city id (either native 'id' or 'wikiDataId') (required)
* @param fromCityId Distance from this city (required)
* @param distanceUnit The unit of distance: MI | KM (optional, default to MI)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call getCityDistanceUsingGETAsync(String cityId, String fromCityId, String distanceUnit, final ApiCallback callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getCityDistanceUsingGETValidateBeforeCall(cityId, fromCityId, distanceUnit, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getCityTimeUsingGET
* @param cityId The city id (either native 'id' or 'wikiDataId') (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call getCityTimeUsingGETCall(String cityId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/geo/cities/{cityId}/time"
.replaceAll("\\{" + "cityId" + "\\}", apiClient.escapeString(cityId.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "UserSecurity" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call getCityTimeUsingGETValidateBeforeCall(String cityId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'cityId' is set
if (cityId == null) {
throw new ApiException("Missing the required parameter 'cityId' when calling getCityTimeUsingGET(Async)");
}
com.squareup.okhttp.Call call = getCityTimeUsingGETCall(cityId, progressListener, progressRequestListener);
return call;
}
/**
* Get city time
* Get city time
* @param cityId The city id (either native 'id' or 'wikiDataId') (required)
* @return TimeResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public TimeResponse getCityTimeUsingGET(String cityId) throws ApiException {
ApiResponse resp = getCityTimeUsingGETWithHttpInfo(cityId);
return resp.getData();
}
/**
* Get city time
* Get city time
* @param cityId The city id (either native 'id' or 'wikiDataId') (required)
* @return ApiResponse<TimeResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getCityTimeUsingGETWithHttpInfo(String cityId) throws ApiException {
com.squareup.okhttp.Call call = getCityTimeUsingGETValidateBeforeCall(cityId, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get city time (asynchronously)
* Get city time
* @param cityId The city id (either native 'id' or 'wikiDataId') (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call getCityTimeUsingGETAsync(String cityId, final ApiCallback callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getCityTimeUsingGETValidateBeforeCall(cityId, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getCityUsingGET
* @param cityId The city id (either native 'id' or 'wikiDataId') (required)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call getCityUsingGETCall(String cityId, Boolean asciiMode, String languageCode, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/geo/cities/{cityId}"
.replaceAll("\\{" + "cityId" + "\\}", apiClient.escapeString(cityId.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (asciiMode != null)
localVarQueryParams.addAll(apiClient.parameterToPair("asciiMode", asciiMode));
if (languageCode != null)
localVarQueryParams.addAll(apiClient.parameterToPair("languageCode", languageCode));
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "UserSecurity" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call getCityUsingGETValidateBeforeCall(String cityId, Boolean asciiMode, String languageCode, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'cityId' is set
if (cityId == null) {
throw new ApiException("Missing the required parameter 'cityId' when calling getCityUsingGET(Async)");
}
com.squareup.okhttp.Call call = getCityUsingGETCall(cityId, asciiMode, languageCode, progressListener, progressRequestListener);
return call;
}
/**
* Get city details
* Get the details for a specific city, including location coordinates, population, and elevation above sea-level (if available).
* @param cityId The city id (either native 'id' or 'wikiDataId') (required)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @return CityResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public CityResponse getCityUsingGET(String cityId, Boolean asciiMode, String languageCode) throws ApiException {
ApiResponse resp = getCityUsingGETWithHttpInfo(cityId, asciiMode, languageCode);
return resp.getData();
}
/**
* Get city details
* Get the details for a specific city, including location coordinates, population, and elevation above sea-level (if available).
* @param cityId The city id (either native 'id' or 'wikiDataId') (required)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @return ApiResponse<CityResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getCityUsingGETWithHttpInfo(String cityId, Boolean asciiMode, String languageCode) throws ApiException {
com.squareup.okhttp.Call call = getCityUsingGETValidateBeforeCall(cityId, asciiMode, languageCode, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get city details (asynchronously)
* Get the details for a specific city, including location coordinates, population, and elevation above sea-level (if available).
* @param cityId The city id (either native 'id' or 'wikiDataId') (required)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call getCityUsingGETAsync(String cityId, Boolean asciiMode, String languageCode, final ApiCallback callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getCityUsingGETValidateBeforeCall(cityId, asciiMode, languageCode, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getCountriesUsingGET
* @param namePrefix Only countries whose names start with this prefix. If languageCode is set, the prefix will be matched on the name as it appears in that language. (optional)
* @param currencyCode Only countries supporting this currency (optional)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param limit The maximum number of results to retrieve (optional, default to 10)
* @param offset The zero-ary offset index into the results (optional, default to 0)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call getCountriesUsingGETCall(String namePrefix, String currencyCode, Boolean asciiMode, String languageCode, Integer limit, Integer offset, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/geo/countries";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (namePrefix != null)
localVarQueryParams.addAll(apiClient.parameterToPair("namePrefix", namePrefix));
if (currencyCode != null)
localVarQueryParams.addAll(apiClient.parameterToPair("currencyCode", currencyCode));
if (asciiMode != null)
localVarQueryParams.addAll(apiClient.parameterToPair("asciiMode", asciiMode));
if (languageCode != null)
localVarQueryParams.addAll(apiClient.parameterToPair("languageCode", languageCode));
if (limit != null)
localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit));
if (offset != null)
localVarQueryParams.addAll(apiClient.parameterToPair("offset", offset));
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "UserSecurity" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call getCountriesUsingGETValidateBeforeCall(String namePrefix, String currencyCode, Boolean asciiMode, String languageCode, Integer limit, Integer offset, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
com.squareup.okhttp.Call call = getCountriesUsingGETCall(namePrefix, currencyCode, asciiMode, languageCode, limit, offset, progressListener, progressRequestListener);
return call;
}
/**
* Find countries
* Find countries, filtering by optional criteria. If no criteria are set, you will get back all known countries.
* @param namePrefix Only countries whose names start with this prefix. If languageCode is set, the prefix will be matched on the name as it appears in that language. (optional)
* @param currencyCode Only countries supporting this currency (optional)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param limit The maximum number of results to retrieve (optional, default to 10)
* @param offset The zero-ary offset index into the results (optional, default to 0)
* @return CountriesResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public CountriesResponse getCountriesUsingGET(String namePrefix, String currencyCode, Boolean asciiMode, String languageCode, Integer limit, Integer offset) throws ApiException {
ApiResponse resp = getCountriesUsingGETWithHttpInfo(namePrefix, currencyCode, asciiMode, languageCode, limit, offset);
return resp.getData();
}
/**
* Find countries
* Find countries, filtering by optional criteria. If no criteria are set, you will get back all known countries.
* @param namePrefix Only countries whose names start with this prefix. If languageCode is set, the prefix will be matched on the name as it appears in that language. (optional)
* @param currencyCode Only countries supporting this currency (optional)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param limit The maximum number of results to retrieve (optional, default to 10)
* @param offset The zero-ary offset index into the results (optional, default to 0)
* @return ApiResponse<CountriesResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getCountriesUsingGETWithHttpInfo(String namePrefix, String currencyCode, Boolean asciiMode, String languageCode, Integer limit, Integer offset) throws ApiException {
com.squareup.okhttp.Call call = getCountriesUsingGETValidateBeforeCall(namePrefix, currencyCode, asciiMode, languageCode, limit, offset, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Find countries (asynchronously)
* Find countries, filtering by optional criteria. If no criteria are set, you will get back all known countries.
* @param namePrefix Only countries whose names start with this prefix. If languageCode is set, the prefix will be matched on the name as it appears in that language. (optional)
* @param currencyCode Only countries supporting this currency (optional)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param limit The maximum number of results to retrieve (optional, default to 10)
* @param offset The zero-ary offset index into the results (optional, default to 0)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call getCountriesUsingGETAsync(String namePrefix, String currencyCode, Boolean asciiMode, String languageCode, Integer limit, Integer offset, final ApiCallback callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getCountriesUsingGETValidateBeforeCall(namePrefix, currencyCode, asciiMode, languageCode, limit, offset, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getCountryUsingGET
* @param countryId An ISO-3166 country code or WikiData id (required)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call getCountryUsingGETCall(String countryId, Boolean asciiMode, String languageCode, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/geo/countries/{countryId}"
.replaceAll("\\{" + "countryId" + "\\}", apiClient.escapeString(countryId.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (asciiMode != null)
localVarQueryParams.addAll(apiClient.parameterToPair("asciiMode", asciiMode));
if (languageCode != null)
localVarQueryParams.addAll(apiClient.parameterToPair("languageCode", languageCode));
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "UserSecurity" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call getCountryUsingGETValidateBeforeCall(String countryId, Boolean asciiMode, String languageCode, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'countryId' is set
if (countryId == null) {
throw new ApiException("Missing the required parameter 'countryId' when calling getCountryUsingGET(Async)");
}
com.squareup.okhttp.Call call = getCountryUsingGETCall(countryId, asciiMode, languageCode, progressListener, progressRequestListener);
return call;
}
/**
* Get country details
* Get the details for a specific country, including number of regions.
* @param countryId An ISO-3166 country code or WikiData id (required)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @return CountryResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public CountryResponse getCountryUsingGET(String countryId, Boolean asciiMode, String languageCode) throws ApiException {
ApiResponse resp = getCountryUsingGETWithHttpInfo(countryId, asciiMode, languageCode);
return resp.getData();
}
/**
* Get country details
* Get the details for a specific country, including number of regions.
* @param countryId An ISO-3166 country code or WikiData id (required)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @return ApiResponse<CountryResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getCountryUsingGETWithHttpInfo(String countryId, Boolean asciiMode, String languageCode) throws ApiException {
com.squareup.okhttp.Call call = getCountryUsingGETValidateBeforeCall(countryId, asciiMode, languageCode, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get country details (asynchronously)
* Get the details for a specific country, including number of regions.
* @param countryId An ISO-3166 country code or WikiData id (required)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call getCountryUsingGETAsync(String countryId, Boolean asciiMode, String languageCode, final ApiCallback callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getCountryUsingGETValidateBeforeCall(countryId, asciiMode, languageCode, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getRegionUsingGET
* @param countryId An ISO-3166 country code or WikiData id (required)
* @param regionCode An ISO-3166 or FIPS region code (required)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call getRegionUsingGETCall(String countryId, String regionCode, Boolean asciiMode, String languageCode, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/geo/countries/{countryId}/regions/{regionCode}"
.replaceAll("\\{" + "countryId" + "\\}", apiClient.escapeString(countryId.toString()))
.replaceAll("\\{" + "regionCode" + "\\}", apiClient.escapeString(regionCode.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (asciiMode != null)
localVarQueryParams.addAll(apiClient.parameterToPair("asciiMode", asciiMode));
if (languageCode != null)
localVarQueryParams.addAll(apiClient.parameterToPair("languageCode", languageCode));
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "UserSecurity" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call getRegionUsingGETValidateBeforeCall(String countryId, String regionCode, Boolean asciiMode, String languageCode, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'countryId' is set
if (countryId == null) {
throw new ApiException("Missing the required parameter 'countryId' when calling getRegionUsingGET(Async)");
}
// verify the required parameter 'regionCode' is set
if (regionCode == null) {
throw new ApiException("Missing the required parameter 'regionCode' when calling getRegionUsingGET(Async)");
}
com.squareup.okhttp.Call call = getRegionUsingGETCall(countryId, regionCode, asciiMode, languageCode, progressListener, progressRequestListener);
return call;
}
/**
* Get region details
* Get the details of a specific country region, including number of cities.
* @param countryId An ISO-3166 country code or WikiData id (required)
* @param regionCode An ISO-3166 or FIPS region code (required)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @return RegionResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public RegionResponse getRegionUsingGET(String countryId, String regionCode, Boolean asciiMode, String languageCode) throws ApiException {
ApiResponse resp = getRegionUsingGETWithHttpInfo(countryId, regionCode, asciiMode, languageCode);
return resp.getData();
}
/**
* Get region details
* Get the details of a specific country region, including number of cities.
* @param countryId An ISO-3166 country code or WikiData id (required)
* @param regionCode An ISO-3166 or FIPS region code (required)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @return ApiResponse<RegionResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getRegionUsingGETWithHttpInfo(String countryId, String regionCode, Boolean asciiMode, String languageCode) throws ApiException {
com.squareup.okhttp.Call call = getRegionUsingGETValidateBeforeCall(countryId, regionCode, asciiMode, languageCode, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get region details (asynchronously)
* Get the details of a specific country region, including number of cities.
* @param countryId An ISO-3166 country code or WikiData id (required)
* @param regionCode An ISO-3166 or FIPS region code (required)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call getRegionUsingGETAsync(String countryId, String regionCode, Boolean asciiMode, String languageCode, final ApiCallback callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getRegionUsingGETValidateBeforeCall(countryId, regionCode, asciiMode, languageCode, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getRegionsUsingGET
* @param countryId An ISO-3166 country code or WikiData id (required)
* @param namePrefix Only regions whose names start with this prefix. If languageCode is set, the prefix will be matched on the name as it appears in that language. (optional)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param limit The maximum number of results to retrieve (optional, default to 10)
* @param offset The zero-ary offset index into the results (optional, default to 0)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call getRegionsUsingGETCall(String countryId, String namePrefix, Boolean asciiMode, String languageCode, Integer limit, Integer offset, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/geo/countries/{countryId}/regions"
.replaceAll("\\{" + "countryId" + "\\}", apiClient.escapeString(countryId.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (namePrefix != null)
localVarQueryParams.addAll(apiClient.parameterToPair("namePrefix", namePrefix));
if (asciiMode != null)
localVarQueryParams.addAll(apiClient.parameterToPair("asciiMode", asciiMode));
if (languageCode != null)
localVarQueryParams.addAll(apiClient.parameterToPair("languageCode", languageCode));
if (limit != null)
localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit));
if (offset != null)
localVarQueryParams.addAll(apiClient.parameterToPair("offset", offset));
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "UserSecurity" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call getRegionsUsingGETValidateBeforeCall(String countryId, String namePrefix, Boolean asciiMode, String languageCode, Integer limit, Integer offset, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'countryId' is set
if (countryId == null) {
throw new ApiException("Missing the required parameter 'countryId' when calling getRegionsUsingGET(Async)");
}
com.squareup.okhttp.Call call = getRegionsUsingGETCall(countryId, namePrefix, asciiMode, languageCode, limit, offset, progressListener, progressRequestListener);
return call;
}
/**
* Find country regions
* Get all regions in a specific country. These could be states, provinces, districts, or otherwise major political divisions.
* @param countryId An ISO-3166 country code or WikiData id (required)
* @param namePrefix Only regions whose names start with this prefix. If languageCode is set, the prefix will be matched on the name as it appears in that language. (optional)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param limit The maximum number of results to retrieve (optional, default to 10)
* @param offset The zero-ary offset index into the results (optional, default to 0)
* @return RegionsResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public RegionsResponse getRegionsUsingGET(String countryId, String namePrefix, Boolean asciiMode, String languageCode, Integer limit, Integer offset) throws ApiException {
ApiResponse resp = getRegionsUsingGETWithHttpInfo(countryId, namePrefix, asciiMode, languageCode, limit, offset);
return resp.getData();
}
/**
* Find country regions
* Get all regions in a specific country. These could be states, provinces, districts, or otherwise major political divisions.
* @param countryId An ISO-3166 country code or WikiData id (required)
* @param namePrefix Only regions whose names start with this prefix. If languageCode is set, the prefix will be matched on the name as it appears in that language. (optional)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param limit The maximum number of results to retrieve (optional, default to 10)
* @param offset The zero-ary offset index into the results (optional, default to 0)
* @return ApiResponse<RegionsResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getRegionsUsingGETWithHttpInfo(String countryId, String namePrefix, Boolean asciiMode, String languageCode, Integer limit, Integer offset) throws ApiException {
com.squareup.okhttp.Call call = getRegionsUsingGETValidateBeforeCall(countryId, namePrefix, asciiMode, languageCode, limit, offset, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Find country regions (asynchronously)
* Get all regions in a specific country. These could be states, provinces, districts, or otherwise major political divisions.
* @param countryId An ISO-3166 country code or WikiData id (required)
* @param namePrefix Only regions whose names start with this prefix. If languageCode is set, the prefix will be matched on the name as it appears in that language. (optional)
* @param asciiMode Display results using ASCII characters (optional, default to false)
* @param languageCode Display results in this language (optional)
* @param limit The maximum number of results to retrieve (optional, default to 10)
* @param offset The zero-ary offset index into the results (optional, default to 0)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call getRegionsUsingGETAsync(String countryId, String namePrefix, Boolean asciiMode, String languageCode, Integer limit, Integer offset, final ApiCallback callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getRegionsUsingGETValidateBeforeCall(countryId, namePrefix, asciiMode, languageCode, limit, offset, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
}