All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.wirefreethought.geodb.client.LocaleApi Maven / Gradle / Ivy

/*
 * GeoDB Cities 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.
  • 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:

  • 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.BadRequestResponse; import com.wirefreethought.geodb.client.model.CurrenciesResponse; import com.wirefreethought.geodb.client.model.DateTimeResponse; import com.wirefreethought.geodb.client.model.ForbiddenResponse; import com.wirefreethought.geodb.client.model.LanguagesResponse; import com.wirefreethought.geodb.client.model.LocalesResponse; import com.wirefreethought.geodb.client.model.NotFoundResponse; 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 Currencies for this country id (required) * @param hateoasMode Include HATEOAS-style links in results (optional, default to true) * @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, Boolean hateoasMode, Integer limit, Integer offset, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/locale/currencies"; List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); if (countryId != null) localVarQueryParams.addAll(apiClient.parameterToPair("countryId", countryId)); if (hateoasMode != null) localVarQueryParams.addAll(apiClient.parameterToPair("hateoasMode", hateoasMode)); 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, Boolean hateoasMode, 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 getCurrenciesUsingGET(Async)"); } com.squareup.okhttp.Call call = getCurrenciesUsingGETCall(countryId, hateoasMode, 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 Currencies for this country id (required) * @param hateoasMode Include HATEOAS-style links in results (optional, default to true) * @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, Boolean hateoasMode, Integer limit, Integer offset) throws ApiException { ApiResponse resp = getCurrenciesUsingGETWithHttpInfo(countryId, hateoasMode, 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 Currencies for this country id (required) * @param hateoasMode Include HATEOAS-style links in results (optional, default to true) * @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, Boolean hateoasMode, Integer limit, Integer offset) throws ApiException { com.squareup.okhttp.Call call = getCurrenciesUsingGETValidateBeforeCall(countryId, hateoasMode, 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 Currencies for this country id (required) * @param hateoasMode Include HATEOAS-style links in results (optional, default to true) * @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, Boolean hateoasMode, 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, hateoasMode, limit, offset, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for getLanguagesUsingGET * @param hateoasMode Include HATEOAS-style links in results (optional, default to true) * @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 getLanguagesUsingGETCall(Boolean hateoasMode, Integer limit, Integer offset, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/locale/languages"; List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); if (hateoasMode != null) localVarQueryParams.addAll(apiClient.parameterToPair("hateoasMode", hateoasMode)); 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 getLanguagesUsingGETValidateBeforeCall(Boolean hateoasMode, Integer limit, Integer offset, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { com.squareup.okhttp.Call call = getLanguagesUsingGETCall(hateoasMode, limit, offset, progressListener, progressRequestListener); return call; } /** * Get languages * Get all supported languages * @param hateoasMode Include HATEOAS-style links in results (optional, default to true) * @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 LanguagesResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public LanguagesResponse getLanguagesUsingGET(Boolean hateoasMode, Integer limit, Integer offset) throws ApiException { ApiResponse resp = getLanguagesUsingGETWithHttpInfo(hateoasMode, limit, offset); return resp.getData(); } /** * Get languages * Get all supported languages * @param hateoasMode Include HATEOAS-style links in results (optional, default to true) * @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<LanguagesResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse getLanguagesUsingGETWithHttpInfo(Boolean hateoasMode, Integer limit, Integer offset) throws ApiException { com.squareup.okhttp.Call call = getLanguagesUsingGETValidateBeforeCall(hateoasMode, limit, offset, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } /** * Get languages (asynchronously) * Get all supported languages * @param hateoasMode Include HATEOAS-style links in results (optional, default to true) * @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 getLanguagesUsingGETAsync(Boolean hateoasMode, 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(hateoasMode, limit, offset, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for getLocalesUsingGET * @param hateoasMode Include HATEOAS-style links in results (optional, default to true) * @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(Boolean hateoasMode, Integer limit, Integer offset, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/locale/locales"; List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); if (hateoasMode != null) localVarQueryParams.addAll(apiClient.parameterToPair("hateoasMode", hateoasMode)); 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(Boolean hateoasMode, Integer limit, Integer offset, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { com.squareup.okhttp.Call call = getLocalesUsingGETCall(hateoasMode, limit, offset, progressListener, progressRequestListener); return call; } /** * Get locales * Get all known locales * @param hateoasMode Include HATEOAS-style links in results (optional, default to true) * @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(Boolean hateoasMode, Integer limit, Integer offset) throws ApiException { ApiResponse resp = getLocalesUsingGETWithHttpInfo(hateoasMode, limit, offset); return resp.getData(); } /** * Get locales * Get all known locales * @param hateoasMode Include HATEOAS-style links in results (optional, default to true) * @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(Boolean hateoasMode, Integer limit, Integer offset) throws ApiException { com.squareup.okhttp.Call call = getLocalesUsingGETValidateBeforeCall(hateoasMode, limit, offset, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } /** * Get locales (asynchronously) * Get all known locales * @param hateoasMode Include HATEOAS-style links in results (optional, default to true) * @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(Boolean hateoasMode, 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(hateoasMode, limit, offset, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for getTimeZoneDateTimeUsingGET * @param zoneId A 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 = "/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 A 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 A 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 A 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 A 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 = "/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 A 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 A 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 A 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 hateoasMode Include HATEOAS-style links in results (optional, default to true) * @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(Boolean hateoasMode, Integer limit, Integer offset, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/locale/timezones"; List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); if (hateoasMode != null) localVarQueryParams.addAll(apiClient.parameterToPair("hateoasMode", hateoasMode)); 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(Boolean hateoasMode, Integer limit, Integer offset, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { com.squareup.okhttp.Call call = getTimezonesUsingGETCall(hateoasMode, limit, offset, progressListener, progressRequestListener); return call; } /** * Get time-zones * Get all known time-zones * @param hateoasMode Include HATEOAS-style links in results (optional, default to true) * @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(Boolean hateoasMode, Integer limit, Integer offset) throws ApiException { ApiResponse resp = getTimezonesUsingGETWithHttpInfo(hateoasMode, limit, offset); return resp.getData(); } /** * Get time-zones * Get all known time-zones * @param hateoasMode Include HATEOAS-style links in results (optional, default to true) * @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(Boolean hateoasMode, Integer limit, Integer offset) throws ApiException { com.squareup.okhttp.Call call = getTimezonesUsingGETValidateBeforeCall(hateoasMode, limit, offset, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } /** * Get time-zones (asynchronously) * Get all known time-zones * @param hateoasMode Include HATEOAS-style links in results (optional, default to true) * @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(Boolean hateoasMode, 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(hateoasMode, limit, offset, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy