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

enterprises.orbital.eve.esi.client.api.MailApi Maven / Gradle / Ivy

The newest version!
/*
 * EVE Swagger Interface
 * An OpenAPI for EVE Online
 *
 * OpenAPI spec version: 1.2.3
 * 
 *
 * 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 enterprises.orbital.eve.esi.client.api;

import enterprises.orbital.eve.esi.client.invoker.ApiCallback;
import enterprises.orbital.eve.esi.client.invoker.ApiClient;
import enterprises.orbital.eve.esi.client.invoker.ApiException;
import enterprises.orbital.eve.esi.client.invoker.ApiResponse;
import enterprises.orbital.eve.esi.client.invoker.Configuration;
import enterprises.orbital.eve.esi.client.invoker.Pair;
import enterprises.orbital.eve.esi.client.invoker.ProgressRequestBody;
import enterprises.orbital.eve.esi.client.invoker.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import enterprises.orbital.eve.esi.client.model.BadRequest;
import enterprises.orbital.eve.esi.client.model.DeleteCharactersCharacterIdMailLabelsLabelIdUnprocessableEntity;
import enterprises.orbital.eve.esi.client.model.ErrorLimited;
import enterprises.orbital.eve.esi.client.model.Forbidden;
import enterprises.orbital.eve.esi.client.model.GatewayTimeout;
import enterprises.orbital.eve.esi.client.model.GetCharactersCharacterIdMail200Ok;
import enterprises.orbital.eve.esi.client.model.GetCharactersCharacterIdMailLabelsOk;
import enterprises.orbital.eve.esi.client.model.GetCharactersCharacterIdMailLists200Ok;
import enterprises.orbital.eve.esi.client.model.GetCharactersCharacterIdMailMailIdNotFound;
import enterprises.orbital.eve.esi.client.model.GetCharactersCharacterIdMailMailIdOk;
import enterprises.orbital.eve.esi.client.model.InternalServerError;
import enterprises.orbital.eve.esi.client.model.PostCharactersCharacterIdMailError520;
import enterprises.orbital.eve.esi.client.model.PostCharactersCharacterIdMailLabelsLabel;
import enterprises.orbital.eve.esi.client.model.PostCharactersCharacterIdMailMail;
import enterprises.orbital.eve.esi.client.model.PutCharactersCharacterIdMailMailIdContents;
import enterprises.orbital.eve.esi.client.model.ServiceUnavailable;
import enterprises.orbital.eve.esi.client.model.Unauthorized;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class MailApi {
    private ApiClient apiClient;

    public MailApi() {
        this(Configuration.getDefaultApiClient());
    }

    public MailApi(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return apiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    /* Build call for deleteCharactersCharacterIdMailLabelsLabelId */
    private com.squareup.okhttp.Call deleteCharactersCharacterIdMailLabelsLabelIdCall(Integer characterId, Integer labelId, String datasource, String token, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/v1/characters/{character_id}/mail/labels/{label_id}/".replaceAll("\\{format\\}","json")
        .replaceAll("\\{" + "character_id" + "\\}", apiClient.escapeString(characterId.toString()))
        .replaceAll("\\{" + "label_id" + "\\}", apiClient.escapeString(labelId.toString()));

        List localVarQueryParams = new ArrayList();
        if (datasource != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "datasource", datasource));
        if (token != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "token", token));

        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[] { "evesso" };
        return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call deleteCharactersCharacterIdMailLabelsLabelIdValidateBeforeCall(Integer characterId, Integer labelId, String datasource, String token, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'characterId' is set
        if (characterId == null) {
            throw new ApiException("Missing the required parameter 'characterId' when calling deleteCharactersCharacterIdMailLabelsLabelId(Async)");
        }
        
        // verify the required parameter 'labelId' is set
        if (labelId == null) {
            throw new ApiException("Missing the required parameter 'labelId' when calling deleteCharactersCharacterIdMailLabelsLabelId(Async)");
        }
        
        
        com.squareup.okhttp.Call call = deleteCharactersCharacterIdMailLabelsLabelIdCall(characterId, labelId, datasource, token, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Delete a mail label
     * Delete a mail label  --- 
     * @param characterId An EVE character ID (required)
     * @param labelId An EVE label id (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param token Access token to use if unable to set a header (optional)
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public void deleteCharactersCharacterIdMailLabelsLabelId(Integer characterId, Integer labelId, String datasource, String token) throws ApiException {
        deleteCharactersCharacterIdMailLabelsLabelIdWithHttpInfo(characterId, labelId, datasource, token);
    }

    /**
     * Delete a mail label
     * Delete a mail label  --- 
     * @param characterId An EVE character ID (required)
     * @param labelId An EVE label id (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param token Access token to use if unable to set a header (optional)
     * @return ApiResponse<Void>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse deleteCharactersCharacterIdMailLabelsLabelIdWithHttpInfo(Integer characterId, Integer labelId, String datasource, String token) throws ApiException {
        com.squareup.okhttp.Call call = deleteCharactersCharacterIdMailLabelsLabelIdValidateBeforeCall(characterId, labelId, datasource, token, null, null);
        return apiClient.execute(call);
    }

    /**
     * Delete a mail label (asynchronously)
     * Delete a mail label  --- 
     * @param characterId An EVE character ID (required)
     * @param labelId An EVE label id (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param token Access token to use if unable to set a header (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 deleteCharactersCharacterIdMailLabelsLabelIdAsync(Integer characterId, Integer labelId, String datasource, String token, 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 = deleteCharactersCharacterIdMailLabelsLabelIdValidateBeforeCall(characterId, labelId, datasource, token, progressListener, progressRequestListener);
        apiClient.executeAsync(call, callback);
        return call;
    }
    /* Build call for deleteCharactersCharacterIdMailMailId */
    private com.squareup.okhttp.Call deleteCharactersCharacterIdMailMailIdCall(Integer characterId, Integer mailId, String datasource, String token, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/v1/characters/{character_id}/mail/{mail_id}/".replaceAll("\\{format\\}","json")
        .replaceAll("\\{" + "character_id" + "\\}", apiClient.escapeString(characterId.toString()))
        .replaceAll("\\{" + "mail_id" + "\\}", apiClient.escapeString(mailId.toString()));

        List localVarQueryParams = new ArrayList();
        if (datasource != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "datasource", datasource));
        if (token != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "token", token));

        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[] { "evesso" };
        return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call deleteCharactersCharacterIdMailMailIdValidateBeforeCall(Integer characterId, Integer mailId, String datasource, String token, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'characterId' is set
        if (characterId == null) {
            throw new ApiException("Missing the required parameter 'characterId' when calling deleteCharactersCharacterIdMailMailId(Async)");
        }
        
        // verify the required parameter 'mailId' is set
        if (mailId == null) {
            throw new ApiException("Missing the required parameter 'mailId' when calling deleteCharactersCharacterIdMailMailId(Async)");
        }
        
        
        com.squareup.okhttp.Call call = deleteCharactersCharacterIdMailMailIdCall(characterId, mailId, datasource, token, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Delete a mail
     * Delete a mail  --- 
     * @param characterId An EVE character ID (required)
     * @param mailId An EVE mail ID (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param token Access token to use if unable to set a header (optional)
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public void deleteCharactersCharacterIdMailMailId(Integer characterId, Integer mailId, String datasource, String token) throws ApiException {
        deleteCharactersCharacterIdMailMailIdWithHttpInfo(characterId, mailId, datasource, token);
    }

    /**
     * Delete a mail
     * Delete a mail  --- 
     * @param characterId An EVE character ID (required)
     * @param mailId An EVE mail ID (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param token Access token to use if unable to set a header (optional)
     * @return ApiResponse<Void>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse deleteCharactersCharacterIdMailMailIdWithHttpInfo(Integer characterId, Integer mailId, String datasource, String token) throws ApiException {
        com.squareup.okhttp.Call call = deleteCharactersCharacterIdMailMailIdValidateBeforeCall(characterId, mailId, datasource, token, null, null);
        return apiClient.execute(call);
    }

    /**
     * Delete a mail (asynchronously)
     * Delete a mail  --- 
     * @param characterId An EVE character ID (required)
     * @param mailId An EVE mail ID (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param token Access token to use if unable to set a header (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 deleteCharactersCharacterIdMailMailIdAsync(Integer characterId, Integer mailId, String datasource, String token, 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 = deleteCharactersCharacterIdMailMailIdValidateBeforeCall(characterId, mailId, datasource, token, progressListener, progressRequestListener);
        apiClient.executeAsync(call, callback);
        return call;
    }
    /* Build call for getCharactersCharacterIdMail */
    private com.squareup.okhttp.Call getCharactersCharacterIdMailCall(Integer characterId, String datasource, String ifNoneMatch, List labels, Integer lastMailId, String token, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/v1/characters/{character_id}/mail/".replaceAll("\\{format\\}","json")
        .replaceAll("\\{" + "character_id" + "\\}", apiClient.escapeString(characterId.toString()));

        List localVarQueryParams = new ArrayList();
        if (datasource != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "datasource", datasource));
        if (labels != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "labels", labels));
        if (lastMailId != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "last_mail_id", lastMailId));
        if (token != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "token", token));

        Map localVarHeaderParams = new HashMap();
        if (ifNoneMatch != null)
        localVarHeaderParams.put("If-None-Match", apiClient.parameterToString(ifNoneMatch));

        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[] { "evesso" };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call getCharactersCharacterIdMailValidateBeforeCall(Integer characterId, String datasource, String ifNoneMatch, List labels, Integer lastMailId, String token, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'characterId' is set
        if (characterId == null) {
            throw new ApiException("Missing the required parameter 'characterId' when calling getCharactersCharacterIdMail(Async)");
        }
        
        
        com.squareup.okhttp.Call call = getCharactersCharacterIdMailCall(characterId, datasource, ifNoneMatch, labels, lastMailId, token, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Return mail headers
     * Return the 50 most recent mail headers belonging to the character that match the query criteria. Queries can be filtered by label, and last_mail_id can be used to paginate backwards  ---  This route is cached for up to 30 seconds
     * @param characterId An EVE character ID (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param ifNoneMatch ETag from a previous request. A 304 will be returned if this matches the current ETag (optional)
     * @param labels Fetch only mails that match one or more of the given labels (optional)
     * @param lastMailId List only mail with an ID lower than the given ID, if present (optional)
     * @param token Access token to use if unable to set a header (optional)
     * @return List<GetCharactersCharacterIdMail200Ok>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public List getCharactersCharacterIdMail(Integer characterId, String datasource, String ifNoneMatch, List labels, Integer lastMailId, String token) throws ApiException {
        ApiResponse> resp = getCharactersCharacterIdMailWithHttpInfo(characterId, datasource, ifNoneMatch, labels, lastMailId, token);
        return resp.getData();
    }

    /**
     * Return mail headers
     * Return the 50 most recent mail headers belonging to the character that match the query criteria. Queries can be filtered by label, and last_mail_id can be used to paginate backwards  ---  This route is cached for up to 30 seconds
     * @param characterId An EVE character ID (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param ifNoneMatch ETag from a previous request. A 304 will be returned if this matches the current ETag (optional)
     * @param labels Fetch only mails that match one or more of the given labels (optional)
     * @param lastMailId List only mail with an ID lower than the given ID, if present (optional)
     * @param token Access token to use if unable to set a header (optional)
     * @return ApiResponse<List<GetCharactersCharacterIdMail200Ok>>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse> getCharactersCharacterIdMailWithHttpInfo(Integer characterId, String datasource, String ifNoneMatch, List labels, Integer lastMailId, String token) throws ApiException {
        com.squareup.okhttp.Call call = getCharactersCharacterIdMailValidateBeforeCall(characterId, datasource, ifNoneMatch, labels, lastMailId, token, null, null);
        Type localVarReturnType = new TypeToken>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Return mail headers (asynchronously)
     * Return the 50 most recent mail headers belonging to the character that match the query criteria. Queries can be filtered by label, and last_mail_id can be used to paginate backwards  ---  This route is cached for up to 30 seconds
     * @param characterId An EVE character ID (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param ifNoneMatch ETag from a previous request. A 304 will be returned if this matches the current ETag (optional)
     * @param labels Fetch only mails that match one or more of the given labels (optional)
     * @param lastMailId List only mail with an ID lower than the given ID, if present (optional)
     * @param token Access token to use if unable to set a header (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 getCharactersCharacterIdMailAsync(Integer characterId, String datasource, String ifNoneMatch, List labels, Integer lastMailId, String token, 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 = getCharactersCharacterIdMailValidateBeforeCall(characterId, datasource, ifNoneMatch, labels, lastMailId, token, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /* Build call for getCharactersCharacterIdMailLabels */
    private com.squareup.okhttp.Call getCharactersCharacterIdMailLabelsCall(Integer characterId, String datasource, String ifNoneMatch, String token, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/v3/characters/{character_id}/mail/labels/".replaceAll("\\{format\\}","json")
        .replaceAll("\\{" + "character_id" + "\\}", apiClient.escapeString(characterId.toString()));

        List localVarQueryParams = new ArrayList();
        if (datasource != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "datasource", datasource));
        if (token != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "token", token));

        Map localVarHeaderParams = new HashMap();
        if (ifNoneMatch != null)
        localVarHeaderParams.put("If-None-Match", apiClient.parameterToString(ifNoneMatch));

        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[] { "evesso" };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call getCharactersCharacterIdMailLabelsValidateBeforeCall(Integer characterId, String datasource, String ifNoneMatch, String token, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'characterId' is set
        if (characterId == null) {
            throw new ApiException("Missing the required parameter 'characterId' when calling getCharactersCharacterIdMailLabels(Async)");
        }
        
        
        com.squareup.okhttp.Call call = getCharactersCharacterIdMailLabelsCall(characterId, datasource, ifNoneMatch, token, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Get mail labels and unread counts
     * Return a list of the users mail labels, unread counts for each label and a total unread count.  ---  This route is cached for up to 30 seconds
     * @param characterId An EVE character ID (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param ifNoneMatch ETag from a previous request. A 304 will be returned if this matches the current ETag (optional)
     * @param token Access token to use if unable to set a header (optional)
     * @return GetCharactersCharacterIdMailLabelsOk
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public GetCharactersCharacterIdMailLabelsOk getCharactersCharacterIdMailLabels(Integer characterId, String datasource, String ifNoneMatch, String token) throws ApiException {
        ApiResponse resp = getCharactersCharacterIdMailLabelsWithHttpInfo(characterId, datasource, ifNoneMatch, token);
        return resp.getData();
    }

    /**
     * Get mail labels and unread counts
     * Return a list of the users mail labels, unread counts for each label and a total unread count.  ---  This route is cached for up to 30 seconds
     * @param characterId An EVE character ID (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param ifNoneMatch ETag from a previous request. A 304 will be returned if this matches the current ETag (optional)
     * @param token Access token to use if unable to set a header (optional)
     * @return ApiResponse<GetCharactersCharacterIdMailLabelsOk>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse getCharactersCharacterIdMailLabelsWithHttpInfo(Integer characterId, String datasource, String ifNoneMatch, String token) throws ApiException {
        com.squareup.okhttp.Call call = getCharactersCharacterIdMailLabelsValidateBeforeCall(characterId, datasource, ifNoneMatch, token, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Get mail labels and unread counts (asynchronously)
     * Return a list of the users mail labels, unread counts for each label and a total unread count.  ---  This route is cached for up to 30 seconds
     * @param characterId An EVE character ID (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param ifNoneMatch ETag from a previous request. A 304 will be returned if this matches the current ETag (optional)
     * @param token Access token to use if unable to set a header (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 getCharactersCharacterIdMailLabelsAsync(Integer characterId, String datasource, String ifNoneMatch, String token, 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 = getCharactersCharacterIdMailLabelsValidateBeforeCall(characterId, datasource, ifNoneMatch, token, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /* Build call for getCharactersCharacterIdMailLists */
    private com.squareup.okhttp.Call getCharactersCharacterIdMailListsCall(Integer characterId, String datasource, String ifNoneMatch, String token, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/v1/characters/{character_id}/mail/lists/".replaceAll("\\{format\\}","json")
        .replaceAll("\\{" + "character_id" + "\\}", apiClient.escapeString(characterId.toString()));

        List localVarQueryParams = new ArrayList();
        if (datasource != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "datasource", datasource));
        if (token != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "token", token));

        Map localVarHeaderParams = new HashMap();
        if (ifNoneMatch != null)
        localVarHeaderParams.put("If-None-Match", apiClient.parameterToString(ifNoneMatch));

        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[] { "evesso" };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call getCharactersCharacterIdMailListsValidateBeforeCall(Integer characterId, String datasource, String ifNoneMatch, String token, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'characterId' is set
        if (characterId == null) {
            throw new ApiException("Missing the required parameter 'characterId' when calling getCharactersCharacterIdMailLists(Async)");
        }
        
        
        com.squareup.okhttp.Call call = getCharactersCharacterIdMailListsCall(characterId, datasource, ifNoneMatch, token, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Return mailing list subscriptions
     * Return all mailing lists that the character is subscribed to  ---  This route is cached for up to 120 seconds
     * @param characterId An EVE character ID (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param ifNoneMatch ETag from a previous request. A 304 will be returned if this matches the current ETag (optional)
     * @param token Access token to use if unable to set a header (optional)
     * @return List<GetCharactersCharacterIdMailLists200Ok>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public List getCharactersCharacterIdMailLists(Integer characterId, String datasource, String ifNoneMatch, String token) throws ApiException {
        ApiResponse> resp = getCharactersCharacterIdMailListsWithHttpInfo(characterId, datasource, ifNoneMatch, token);
        return resp.getData();
    }

    /**
     * Return mailing list subscriptions
     * Return all mailing lists that the character is subscribed to  ---  This route is cached for up to 120 seconds
     * @param characterId An EVE character ID (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param ifNoneMatch ETag from a previous request. A 304 will be returned if this matches the current ETag (optional)
     * @param token Access token to use if unable to set a header (optional)
     * @return ApiResponse<List<GetCharactersCharacterIdMailLists200Ok>>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse> getCharactersCharacterIdMailListsWithHttpInfo(Integer characterId, String datasource, String ifNoneMatch, String token) throws ApiException {
        com.squareup.okhttp.Call call = getCharactersCharacterIdMailListsValidateBeforeCall(characterId, datasource, ifNoneMatch, token, null, null);
        Type localVarReturnType = new TypeToken>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Return mailing list subscriptions (asynchronously)
     * Return all mailing lists that the character is subscribed to  ---  This route is cached for up to 120 seconds
     * @param characterId An EVE character ID (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param ifNoneMatch ETag from a previous request. A 304 will be returned if this matches the current ETag (optional)
     * @param token Access token to use if unable to set a header (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 getCharactersCharacterIdMailListsAsync(Integer characterId, String datasource, String ifNoneMatch, String token, 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 = getCharactersCharacterIdMailListsValidateBeforeCall(characterId, datasource, ifNoneMatch, token, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /* Build call for getCharactersCharacterIdMailMailId */
    private com.squareup.okhttp.Call getCharactersCharacterIdMailMailIdCall(Integer characterId, Integer mailId, String datasource, String ifNoneMatch, String token, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/v1/characters/{character_id}/mail/{mail_id}/".replaceAll("\\{format\\}","json")
        .replaceAll("\\{" + "character_id" + "\\}", apiClient.escapeString(characterId.toString()))
        .replaceAll("\\{" + "mail_id" + "\\}", apiClient.escapeString(mailId.toString()));

        List localVarQueryParams = new ArrayList();
        if (datasource != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "datasource", datasource));
        if (token != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "token", token));

        Map localVarHeaderParams = new HashMap();
        if (ifNoneMatch != null)
        localVarHeaderParams.put("If-None-Match", apiClient.parameterToString(ifNoneMatch));

        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[] { "evesso" };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call getCharactersCharacterIdMailMailIdValidateBeforeCall(Integer characterId, Integer mailId, String datasource, String ifNoneMatch, String token, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'characterId' is set
        if (characterId == null) {
            throw new ApiException("Missing the required parameter 'characterId' when calling getCharactersCharacterIdMailMailId(Async)");
        }
        
        // verify the required parameter 'mailId' is set
        if (mailId == null) {
            throw new ApiException("Missing the required parameter 'mailId' when calling getCharactersCharacterIdMailMailId(Async)");
        }
        
        
        com.squareup.okhttp.Call call = getCharactersCharacterIdMailMailIdCall(characterId, mailId, datasource, ifNoneMatch, token, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Return a mail
     * Return the contents of an EVE mail  ---  This route is cached for up to 30 seconds
     * @param characterId An EVE character ID (required)
     * @param mailId An EVE mail ID (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param ifNoneMatch ETag from a previous request. A 304 will be returned if this matches the current ETag (optional)
     * @param token Access token to use if unable to set a header (optional)
     * @return GetCharactersCharacterIdMailMailIdOk
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public GetCharactersCharacterIdMailMailIdOk getCharactersCharacterIdMailMailId(Integer characterId, Integer mailId, String datasource, String ifNoneMatch, String token) throws ApiException {
        ApiResponse resp = getCharactersCharacterIdMailMailIdWithHttpInfo(characterId, mailId, datasource, ifNoneMatch, token);
        return resp.getData();
    }

    /**
     * Return a mail
     * Return the contents of an EVE mail  ---  This route is cached for up to 30 seconds
     * @param characterId An EVE character ID (required)
     * @param mailId An EVE mail ID (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param ifNoneMatch ETag from a previous request. A 304 will be returned if this matches the current ETag (optional)
     * @param token Access token to use if unable to set a header (optional)
     * @return ApiResponse<GetCharactersCharacterIdMailMailIdOk>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse getCharactersCharacterIdMailMailIdWithHttpInfo(Integer characterId, Integer mailId, String datasource, String ifNoneMatch, String token) throws ApiException {
        com.squareup.okhttp.Call call = getCharactersCharacterIdMailMailIdValidateBeforeCall(characterId, mailId, datasource, ifNoneMatch, token, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Return a mail (asynchronously)
     * Return the contents of an EVE mail  ---  This route is cached for up to 30 seconds
     * @param characterId An EVE character ID (required)
     * @param mailId An EVE mail ID (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param ifNoneMatch ETag from a previous request. A 304 will be returned if this matches the current ETag (optional)
     * @param token Access token to use if unable to set a header (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 getCharactersCharacterIdMailMailIdAsync(Integer characterId, Integer mailId, String datasource, String ifNoneMatch, String token, 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 = getCharactersCharacterIdMailMailIdValidateBeforeCall(characterId, mailId, datasource, ifNoneMatch, token, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /* Build call for postCharactersCharacterIdMail */
    private com.squareup.okhttp.Call postCharactersCharacterIdMailCall(Integer characterId, PostCharactersCharacterIdMailMail mail, String datasource, String token, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = mail;
        
        // create path and map variables
        String localVarPath = "/v1/characters/{character_id}/mail/".replaceAll("\\{format\\}","json")
        .replaceAll("\\{" + "character_id" + "\\}", apiClient.escapeString(characterId.toString()));

        List localVarQueryParams = new ArrayList();
        if (datasource != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "datasource", datasource));
        if (token != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "token", token));

        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[] { "evesso" };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call postCharactersCharacterIdMailValidateBeforeCall(Integer characterId, PostCharactersCharacterIdMailMail mail, String datasource, String token, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'characterId' is set
        if (characterId == null) {
            throw new ApiException("Missing the required parameter 'characterId' when calling postCharactersCharacterIdMail(Async)");
        }
        
        // verify the required parameter 'mail' is set
        if (mail == null) {
            throw new ApiException("Missing the required parameter 'mail' when calling postCharactersCharacterIdMail(Async)");
        }
        
        
        com.squareup.okhttp.Call call = postCharactersCharacterIdMailCall(characterId, mail, datasource, token, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Send a new mail
     * Create and send a new mail  --- 
     * @param characterId An EVE character ID (required)
     * @param mail The mail to send (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param token Access token to use if unable to set a header (optional)
     * @return Integer
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public Integer postCharactersCharacterIdMail(Integer characterId, PostCharactersCharacterIdMailMail mail, String datasource, String token) throws ApiException {
        ApiResponse resp = postCharactersCharacterIdMailWithHttpInfo(characterId, mail, datasource, token);
        return resp.getData();
    }

    /**
     * Send a new mail
     * Create and send a new mail  --- 
     * @param characterId An EVE character ID (required)
     * @param mail The mail to send (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param token Access token to use if unable to set a header (optional)
     * @return ApiResponse<Integer>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse postCharactersCharacterIdMailWithHttpInfo(Integer characterId, PostCharactersCharacterIdMailMail mail, String datasource, String token) throws ApiException {
        com.squareup.okhttp.Call call = postCharactersCharacterIdMailValidateBeforeCall(characterId, mail, datasource, token, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Send a new mail (asynchronously)
     * Create and send a new mail  --- 
     * @param characterId An EVE character ID (required)
     * @param mail The mail to send (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param token Access token to use if unable to set a header (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 postCharactersCharacterIdMailAsync(Integer characterId, PostCharactersCharacterIdMailMail mail, String datasource, String token, 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 = postCharactersCharacterIdMailValidateBeforeCall(characterId, mail, datasource, token, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /* Build call for postCharactersCharacterIdMailLabels */
    private com.squareup.okhttp.Call postCharactersCharacterIdMailLabelsCall(Integer characterId, PostCharactersCharacterIdMailLabelsLabel label, String datasource, String token, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = label;
        
        // create path and map variables
        String localVarPath = "/v2/characters/{character_id}/mail/labels/".replaceAll("\\{format\\}","json")
        .replaceAll("\\{" + "character_id" + "\\}", apiClient.escapeString(characterId.toString()));

        List localVarQueryParams = new ArrayList();
        if (datasource != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "datasource", datasource));
        if (token != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "token", token));

        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[] { "evesso" };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call postCharactersCharacterIdMailLabelsValidateBeforeCall(Integer characterId, PostCharactersCharacterIdMailLabelsLabel label, String datasource, String token, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'characterId' is set
        if (characterId == null) {
            throw new ApiException("Missing the required parameter 'characterId' when calling postCharactersCharacterIdMailLabels(Async)");
        }
        
        // verify the required parameter 'label' is set
        if (label == null) {
            throw new ApiException("Missing the required parameter 'label' when calling postCharactersCharacterIdMailLabels(Async)");
        }
        
        
        com.squareup.okhttp.Call call = postCharactersCharacterIdMailLabelsCall(characterId, label, datasource, token, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Create a mail label
     * Create a mail label  --- 
     * @param characterId An EVE character ID (required)
     * @param label Label to create (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param token Access token to use if unable to set a header (optional)
     * @return Integer
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public Integer postCharactersCharacterIdMailLabels(Integer characterId, PostCharactersCharacterIdMailLabelsLabel label, String datasource, String token) throws ApiException {
        ApiResponse resp = postCharactersCharacterIdMailLabelsWithHttpInfo(characterId, label, datasource, token);
        return resp.getData();
    }

    /**
     * Create a mail label
     * Create a mail label  --- 
     * @param characterId An EVE character ID (required)
     * @param label Label to create (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param token Access token to use if unable to set a header (optional)
     * @return ApiResponse<Integer>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse postCharactersCharacterIdMailLabelsWithHttpInfo(Integer characterId, PostCharactersCharacterIdMailLabelsLabel label, String datasource, String token) throws ApiException {
        com.squareup.okhttp.Call call = postCharactersCharacterIdMailLabelsValidateBeforeCall(characterId, label, datasource, token, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Create a mail label (asynchronously)
     * Create a mail label  --- 
     * @param characterId An EVE character ID (required)
     * @param label Label to create (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param token Access token to use if unable to set a header (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 postCharactersCharacterIdMailLabelsAsync(Integer characterId, PostCharactersCharacterIdMailLabelsLabel label, String datasource, String token, 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 = postCharactersCharacterIdMailLabelsValidateBeforeCall(characterId, label, datasource, token, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /* Build call for putCharactersCharacterIdMailMailId */
    private com.squareup.okhttp.Call putCharactersCharacterIdMailMailIdCall(Integer characterId, PutCharactersCharacterIdMailMailIdContents contents, Integer mailId, String datasource, String token, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = contents;
        
        // create path and map variables
        String localVarPath = "/v1/characters/{character_id}/mail/{mail_id}/".replaceAll("\\{format\\}","json")
        .replaceAll("\\{" + "character_id" + "\\}", apiClient.escapeString(characterId.toString()))
        .replaceAll("\\{" + "mail_id" + "\\}", apiClient.escapeString(mailId.toString()));

        List localVarQueryParams = new ArrayList();
        if (datasource != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "datasource", datasource));
        if (token != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "token", token));

        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[] { "evesso" };
        return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call putCharactersCharacterIdMailMailIdValidateBeforeCall(Integer characterId, PutCharactersCharacterIdMailMailIdContents contents, Integer mailId, String datasource, String token, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'characterId' is set
        if (characterId == null) {
            throw new ApiException("Missing the required parameter 'characterId' when calling putCharactersCharacterIdMailMailId(Async)");
        }
        
        // verify the required parameter 'contents' is set
        if (contents == null) {
            throw new ApiException("Missing the required parameter 'contents' when calling putCharactersCharacterIdMailMailId(Async)");
        }
        
        // verify the required parameter 'mailId' is set
        if (mailId == null) {
            throw new ApiException("Missing the required parameter 'mailId' when calling putCharactersCharacterIdMailMailId(Async)");
        }
        
        
        com.squareup.okhttp.Call call = putCharactersCharacterIdMailMailIdCall(characterId, contents, mailId, datasource, token, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Update metadata about a mail
     * Update metadata about a mail  --- 
     * @param characterId An EVE character ID (required)
     * @param contents Data used to update the mail (required)
     * @param mailId An EVE mail ID (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param token Access token to use if unable to set a header (optional)
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public void putCharactersCharacterIdMailMailId(Integer characterId, PutCharactersCharacterIdMailMailIdContents contents, Integer mailId, String datasource, String token) throws ApiException {
        putCharactersCharacterIdMailMailIdWithHttpInfo(characterId, contents, mailId, datasource, token);
    }

    /**
     * Update metadata about a mail
     * Update metadata about a mail  --- 
     * @param characterId An EVE character ID (required)
     * @param contents Data used to update the mail (required)
     * @param mailId An EVE mail ID (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param token Access token to use if unable to set a header (optional)
     * @return ApiResponse<Void>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse putCharactersCharacterIdMailMailIdWithHttpInfo(Integer characterId, PutCharactersCharacterIdMailMailIdContents contents, Integer mailId, String datasource, String token) throws ApiException {
        com.squareup.okhttp.Call call = putCharactersCharacterIdMailMailIdValidateBeforeCall(characterId, contents, mailId, datasource, token, null, null);
        return apiClient.execute(call);
    }

    /**
     * Update metadata about a mail (asynchronously)
     * Update metadata about a mail  --- 
     * @param characterId An EVE character ID (required)
     * @param contents Data used to update the mail (required)
     * @param mailId An EVE mail ID (required)
     * @param datasource The server name you would like data from (optional, default to tranquility)
     * @param token Access token to use if unable to set a header (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 putCharactersCharacterIdMailMailIdAsync(Integer characterId, PutCharactersCharacterIdMailMailIdContents contents, Integer mailId, String datasource, String token, 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 = putCharactersCharacterIdMailMailIdValidateBeforeCall(characterId, contents, mailId, datasource, token, progressListener, progressRequestListener);
        apiClient.executeAsync(call, callback);
        return call;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy