com.wirefreethought.geodb.client.LocaleApi 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.CurrenciesResponse;
import com.wirefreethought.geodb.client.model.DateTimeResponse;
import com.wirefreethought.geodb.client.model.LanguagesResponse;
import com.wirefreethought.geodb.client.model.LocalesResponse;
import com.wirefreethought.geodb.client.model.TimeResponse;
import com.wirefreethought.geodb.client.model.TimeZonesResponse;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class LocaleApi {
private ApiClient apiClient;
public LocaleApi() {
this(Configuration.getDefaultApiClient());
}
public LocaleApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Build call for getCurrenciesUsingGET
* @param countryId Only currencies supported by this country (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 getCurrenciesUsingGETCall(String countryId, 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/locale/currencies";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (countryId != null)
localVarQueryParams.addAll(apiClient.parameterToPair("countryId", countryId));
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 getCurrenciesUsingGETValidateBeforeCall(String countryId, Integer limit, Integer offset, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
com.squareup.okhttp.Call call = getCurrenciesUsingGETCall(countryId, limit, offset, progressListener, progressRequestListener);
return call;
}
/**
* Find currencies
* Find currencies, filtering by optional criteria. If no criteria are set, you will get back all known currencies.
* @param countryId Only currencies supported by this country (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 CurrenciesResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public CurrenciesResponse getCurrenciesUsingGET(String countryId, Integer limit, Integer offset) throws ApiException {
ApiResponse resp = getCurrenciesUsingGETWithHttpInfo(countryId, limit, offset);
return resp.getData();
}
/**
* Find currencies
* Find currencies, filtering by optional criteria. If no criteria are set, you will get back all known currencies.
* @param countryId Only currencies supported by this country (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<CurrenciesResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getCurrenciesUsingGETWithHttpInfo(String countryId, Integer limit, Integer offset) throws ApiException {
com.squareup.okhttp.Call call = getCurrenciesUsingGETValidateBeforeCall(countryId, limit, offset, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Find currencies (asynchronously)
* Find currencies, filtering by optional criteria. If no criteria are set, you will get back all known currencies.
* @param countryId Only currencies supported by this country (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 getCurrenciesUsingGETAsync(String countryId, 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 = getCurrenciesUsingGETValidateBeforeCall(countryId, limit, offset, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getLanguagesUsingGET
* @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 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 getLanguagesUsingGETCall(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/locale/languages";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
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 = {
};
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 getLanguagesUsingGETValidateBeforeCall(Integer limit, Integer offset, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
com.squareup.okhttp.Call call = getLanguagesUsingGETCall(limit, offset, progressListener, progressRequestListener);
return call;
}
/**
* Get languages
* Get all supported languages
* @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)
* @return LanguagesResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public LanguagesResponse getLanguagesUsingGET(Integer limit, Integer offset) throws ApiException {
ApiResponse resp = getLanguagesUsingGETWithHttpInfo(limit, offset);
return resp.getData();
}
/**
* Get languages
* Get all supported languages
* @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)
* @return ApiResponse<LanguagesResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getLanguagesUsingGETWithHttpInfo(Integer limit, Integer offset) throws ApiException {
com.squareup.okhttp.Call call = getLanguagesUsingGETValidateBeforeCall(limit, offset, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get languages (asynchronously)
* Get all supported languages
* @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 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 getLanguagesUsingGETAsync(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 = getLanguagesUsingGETValidateBeforeCall(limit, offset, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getLocalesUsingGET
* @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 getLocalesUsingGETCall(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/locale/locales";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
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 getLocalesUsingGETValidateBeforeCall(Integer limit, Integer offset, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
com.squareup.okhttp.Call call = getLocalesUsingGETCall(limit, offset, progressListener, progressRequestListener);
return call;
}
/**
* Get locales
* Get all known locales
* @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 LocalesResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public LocalesResponse getLocalesUsingGET(Integer limit, Integer offset) throws ApiException {
ApiResponse resp = getLocalesUsingGETWithHttpInfo(limit, offset);
return resp.getData();
}
/**
* Get locales
* Get all known locales
* @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<LocalesResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getLocalesUsingGETWithHttpInfo(Integer limit, Integer offset) throws ApiException {
com.squareup.okhttp.Call call = getLocalesUsingGETValidateBeforeCall(limit, offset, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get locales (asynchronously)
* Get all known locales
* @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 getLocalesUsingGETAsync(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 = getLocalesUsingGETValidateBeforeCall(limit, offset, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getTimeZoneDateTimeUsingGET
* @param zoneId The time-zone id (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 getTimeZoneDateTimeUsingGETCall(String zoneId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/locale/timezones/{zoneId}/dateTime"
.replaceAll("\\{" + "zoneId" + "\\}", apiClient.escapeString(zoneId.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 getTimeZoneDateTimeUsingGETValidateBeforeCall(String zoneId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'zoneId' is set
if (zoneId == null) {
throw new ApiException("Missing the required parameter 'zoneId' when calling getTimeZoneDateTimeUsingGET(Async)");
}
com.squareup.okhttp.Call call = getTimeZoneDateTimeUsingGETCall(zoneId, progressListener, progressRequestListener);
return call;
}
/**
* Get time-zone date-time
* Get time-zone date-time
* @param zoneId The time-zone id (required)
* @return DateTimeResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public DateTimeResponse getTimeZoneDateTimeUsingGET(String zoneId) throws ApiException {
ApiResponse resp = getTimeZoneDateTimeUsingGETWithHttpInfo(zoneId);
return resp.getData();
}
/**
* Get time-zone date-time
* Get time-zone date-time
* @param zoneId The time-zone id (required)
* @return ApiResponse<DateTimeResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getTimeZoneDateTimeUsingGETWithHttpInfo(String zoneId) throws ApiException {
com.squareup.okhttp.Call call = getTimeZoneDateTimeUsingGETValidateBeforeCall(zoneId, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get time-zone date-time (asynchronously)
* Get time-zone date-time
* @param zoneId The time-zone id (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 getTimeZoneDateTimeUsingGETAsync(String zoneId, 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 = getTimeZoneDateTimeUsingGETValidateBeforeCall(zoneId, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getTimeZoneTimeUsingGET
* @param zoneId The time-zone id (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 getTimeZoneTimeUsingGETCall(String zoneId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/locale/timezones/{zoneId}/time"
.replaceAll("\\{" + "zoneId" + "\\}", apiClient.escapeString(zoneId.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 getTimeZoneTimeUsingGETValidateBeforeCall(String zoneId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'zoneId' is set
if (zoneId == null) {
throw new ApiException("Missing the required parameter 'zoneId' when calling getTimeZoneTimeUsingGET(Async)");
}
com.squareup.okhttp.Call call = getTimeZoneTimeUsingGETCall(zoneId, progressListener, progressRequestListener);
return call;
}
/**
* Get time-zone time
* Get time-zone time
* @param zoneId The time-zone id (required)
* @return TimeResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public TimeResponse getTimeZoneTimeUsingGET(String zoneId) throws ApiException {
ApiResponse resp = getTimeZoneTimeUsingGETWithHttpInfo(zoneId);
return resp.getData();
}
/**
* Get time-zone time
* Get time-zone time
* @param zoneId The time-zone id (required)
* @return ApiResponse<TimeResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getTimeZoneTimeUsingGETWithHttpInfo(String zoneId) throws ApiException {
com.squareup.okhttp.Call call = getTimeZoneTimeUsingGETValidateBeforeCall(zoneId, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get time-zone time (asynchronously)
* Get time-zone time
* @param zoneId The time-zone id (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 getTimeZoneTimeUsingGETAsync(String zoneId, 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 = getTimeZoneTimeUsingGETValidateBeforeCall(zoneId, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getTimezonesUsingGET
* @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 getTimezonesUsingGETCall(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/locale/timezones";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
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 getTimezonesUsingGETValidateBeforeCall(Integer limit, Integer offset, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
com.squareup.okhttp.Call call = getTimezonesUsingGETCall(limit, offset, progressListener, progressRequestListener);
return call;
}
/**
* Get time-zones
* Get all known time-zones
* @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 TimeZonesResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public TimeZonesResponse getTimezonesUsingGET(Integer limit, Integer offset) throws ApiException {
ApiResponse resp = getTimezonesUsingGETWithHttpInfo(limit, offset);
return resp.getData();
}
/**
* Get time-zones
* Get all known time-zones
* @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<TimeZonesResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getTimezonesUsingGETWithHttpInfo(Integer limit, Integer offset) throws ApiException {
com.squareup.okhttp.Call call = getTimezonesUsingGETValidateBeforeCall(limit, offset, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get time-zones (asynchronously)
* Get all known time-zones
* @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 getTimezonesUsingGETAsync(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 = getTimezonesUsingGETValidateBeforeCall(limit, offset, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
}