ClickSend.Api.ContactApi Maven / Gradle / Ivy
The newest version!
/*
* ClickSend v3 API
* This is an official SDK for [ClickSend](https://clicksend.com) Below you will find a current list of the available methods for clicksend. *NOTE: You will need to create a free account to use the API. You can register [here](https://dashboard.clicksend.com/#/signup/step1/)..*
*
* OpenAPI spec version: 3.1
* Contact: [email protected]
*
* 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 ClickSend.Api;
import ClickSend.ApiCallback;
import ClickSend.ApiClient;
import ClickSend.ApiException;
import ClickSend.ApiResponse;
import ClickSend.Configuration;
import ClickSend.Pair;
import ClickSend.ProgressRequestBody;
import ClickSend.ProgressResponseBody;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import ClickSend.Model.Contact;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ContactApi {
private ApiClient apiClient;
public ContactApi() {
this(Configuration.getDefaultApiClient());
}
public ContactApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Build call for listsContactsByListIdAndContactIdDelete
* @param listId List ID (required)
* @param contactId Contact 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 listsContactsByListIdAndContactIdDeleteCall(Integer listId, Integer contactId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/lists/{list_id}/contacts/{contact_id}"
.replaceAll("\\{" + "list_id" + "\\}", apiClient.escapeString(listId.toString()))
.replaceAll("\\{" + "contact_id" + "\\}", apiClient.escapeString(contactId.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[] { "BasicAuth" };
return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call listsContactsByListIdAndContactIdDeleteValidateBeforeCall(Integer listId, Integer contactId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'listId' is set
if (listId == null) {
throw new ApiException("Missing the required parameter 'listId' when calling listsContactsByListIdAndContactIdDelete(Async)");
}
// verify the required parameter 'contactId' is set
if (contactId == null) {
throw new ApiException("Missing the required parameter 'contactId' when calling listsContactsByListIdAndContactIdDelete(Async)");
}
com.squareup.okhttp.Call call = listsContactsByListIdAndContactIdDeleteCall(listId, contactId, progressListener, progressRequestListener);
return call;
}
/**
* Delete a contact
* Delete a contact
* @param listId List ID (required)
* @param contactId Contact ID (required)
* @return String
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public String listsContactsByListIdAndContactIdDelete(Integer listId, Integer contactId) throws ApiException {
ApiResponse resp = listsContactsByListIdAndContactIdDeleteWithHttpInfo(listId, contactId);
return resp.getData();
}
/**
* Delete a contact
* Delete a contact
* @param listId List ID (required)
* @param contactId Contact ID (required)
* @return ApiResponse<String>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse listsContactsByListIdAndContactIdDeleteWithHttpInfo(Integer listId, Integer contactId) throws ApiException {
com.squareup.okhttp.Call call = listsContactsByListIdAndContactIdDeleteValidateBeforeCall(listId, contactId, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Delete a contact (asynchronously)
* Delete a contact
* @param listId List ID (required)
* @param contactId Contact 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 listsContactsByListIdAndContactIdDeleteAsync(Integer listId, Integer contactId, 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 = listsContactsByListIdAndContactIdDeleteValidateBeforeCall(listId, contactId, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for listsContactsByListIdAndContactIdGet
* @param listId Your contact list id you want to access. (required)
* @param contactId Your contact id you want to access. (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 listsContactsByListIdAndContactIdGetCall(Integer listId, Integer contactId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/lists/{list_id}/contacts/{contact_id}"
.replaceAll("\\{" + "list_id" + "\\}", apiClient.escapeString(listId.toString()))
.replaceAll("\\{" + "contact_id" + "\\}", apiClient.escapeString(contactId.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[] { "BasicAuth" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call listsContactsByListIdAndContactIdGetValidateBeforeCall(Integer listId, Integer contactId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'listId' is set
if (listId == null) {
throw new ApiException("Missing the required parameter 'listId' when calling listsContactsByListIdAndContactIdGet(Async)");
}
// verify the required parameter 'contactId' is set
if (contactId == null) {
throw new ApiException("Missing the required parameter 'contactId' when calling listsContactsByListIdAndContactIdGet(Async)");
}
com.squareup.okhttp.Call call = listsContactsByListIdAndContactIdGetCall(listId, contactId, progressListener, progressRequestListener);
return call;
}
/**
* Get a specific contact
* Get a specific contact
* @param listId Your contact list id you want to access. (required)
* @param contactId Your contact id you want to access. (required)
* @return String
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public String listsContactsByListIdAndContactIdGet(Integer listId, Integer contactId) throws ApiException {
ApiResponse resp = listsContactsByListIdAndContactIdGetWithHttpInfo(listId, contactId);
return resp.getData();
}
/**
* Get a specific contact
* Get a specific contact
* @param listId Your contact list id you want to access. (required)
* @param contactId Your contact id you want to access. (required)
* @return ApiResponse<String>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse listsContactsByListIdAndContactIdGetWithHttpInfo(Integer listId, Integer contactId) throws ApiException {
com.squareup.okhttp.Call call = listsContactsByListIdAndContactIdGetValidateBeforeCall(listId, contactId, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get a specific contact (asynchronously)
* Get a specific contact
* @param listId Your contact list id you want to access. (required)
* @param contactId Your contact id you want to access. (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 listsContactsByListIdAndContactIdGetAsync(Integer listId, Integer contactId, 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 = listsContactsByListIdAndContactIdGetValidateBeforeCall(listId, contactId, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for listsContactsByListIdAndContactIdPut
* @param listId Contact list id (required)
* @param contactId Contact ID (required)
* @param contact Contact model (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 listsContactsByListIdAndContactIdPutCall(Integer listId, Integer contactId, Contact contact, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = contact;
// create path and map variables
String localVarPath = "/lists/{list_id}/contacts/{contact_id}"
.replaceAll("\\{" + "list_id" + "\\}", apiClient.escapeString(listId.toString()))
.replaceAll("\\{" + "contact_id" + "\\}", apiClient.escapeString(contactId.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[] { "BasicAuth" };
return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call listsContactsByListIdAndContactIdPutValidateBeforeCall(Integer listId, Integer contactId, Contact contact, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'listId' is set
if (listId == null) {
throw new ApiException("Missing the required parameter 'listId' when calling listsContactsByListIdAndContactIdPut(Async)");
}
// verify the required parameter 'contactId' is set
if (contactId == null) {
throw new ApiException("Missing the required parameter 'contactId' when calling listsContactsByListIdAndContactIdPut(Async)");
}
// verify the required parameter 'contact' is set
if (contact == null) {
throw new ApiException("Missing the required parameter 'contact' when calling listsContactsByListIdAndContactIdPut(Async)");
}
com.squareup.okhttp.Call call = listsContactsByListIdAndContactIdPutCall(listId, contactId, contact, progressListener, progressRequestListener);
return call;
}
/**
* Update specific contact
* Update specific contact
* @param listId Contact list id (required)
* @param contactId Contact ID (required)
* @param contact Contact model (required)
* @return String
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public String listsContactsByListIdAndContactIdPut(Integer listId, Integer contactId, Contact contact) throws ApiException {
ApiResponse resp = listsContactsByListIdAndContactIdPutWithHttpInfo(listId, contactId, contact);
return resp.getData();
}
/**
* Update specific contact
* Update specific contact
* @param listId Contact list id (required)
* @param contactId Contact ID (required)
* @param contact Contact model (required)
* @return ApiResponse<String>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse listsContactsByListIdAndContactIdPutWithHttpInfo(Integer listId, Integer contactId, Contact contact) throws ApiException {
com.squareup.okhttp.Call call = listsContactsByListIdAndContactIdPutValidateBeforeCall(listId, contactId, contact, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Update specific contact (asynchronously)
* Update specific contact
* @param listId Contact list id (required)
* @param contactId Contact ID (required)
* @param contact Contact model (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 listsContactsByListIdAndContactIdPutAsync(Integer listId, Integer contactId, Contact contact, 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 = listsContactsByListIdAndContactIdPutValidateBeforeCall(listId, contactId, contact, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for listsContactsByListIdGet
* @param listId Contact list ID (required)
* @param page Page number (optional, default to 1)
* @param limit Number of records per page (optional, default to 10)
* @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 listsContactsByListIdGetCall(Integer listId, Integer page, Integer limit, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/lists/{list_id}/contacts"
.replaceAll("\\{" + "list_id" + "\\}", apiClient.escapeString(listId.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (page != null)
localVarQueryParams.addAll(apiClient.parameterToPair("page", page));
if (limit != null)
localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit));
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[] { "BasicAuth" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call listsContactsByListIdGetValidateBeforeCall(Integer listId, Integer page, Integer limit, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'listId' is set
if (listId == null) {
throw new ApiException("Missing the required parameter 'listId' when calling listsContactsByListIdGet(Async)");
}
com.squareup.okhttp.Call call = listsContactsByListIdGetCall(listId, page, limit, progressListener, progressRequestListener);
return call;
}
/**
* Get all contacts in a list
* Get all contacts in a list
* @param listId Contact list ID (required)
* @param page Page number (optional, default to 1)
* @param limit Number of records per page (optional, default to 10)
* @return String
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public String listsContactsByListIdGet(Integer listId, Integer page, Integer limit) throws ApiException {
ApiResponse resp = listsContactsByListIdGetWithHttpInfo(listId, page, limit);
return resp.getData();
}
/**
* Get all contacts in a list
* Get all contacts in a list
* @param listId Contact list ID (required)
* @param page Page number (optional, default to 1)
* @param limit Number of records per page (optional, default to 10)
* @return ApiResponse<String>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse listsContactsByListIdGetWithHttpInfo(Integer listId, Integer page, Integer limit) throws ApiException {
com.squareup.okhttp.Call call = listsContactsByListIdGetValidateBeforeCall(listId, page, limit, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get all contacts in a list (asynchronously)
* Get all contacts in a list
* @param listId Contact list ID (required)
* @param page Page number (optional, default to 1)
* @param limit Number of records per page (optional, default to 10)
* @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 listsContactsByListIdGetAsync(Integer listId, Integer page, Integer limit, 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 = listsContactsByListIdGetValidateBeforeCall(listId, page, limit, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for listsContactsByListIdPost
* @param contact Contact model (required)
* @param listId List 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 listsContactsByListIdPostCall(Contact contact, Integer listId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = contact;
// create path and map variables
String localVarPath = "/lists/{list_id}/contacts"
.replaceAll("\\{" + "list_id" + "\\}", apiClient.escapeString(listId.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[] { "BasicAuth" };
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call listsContactsByListIdPostValidateBeforeCall(Contact contact, Integer listId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'contact' is set
if (contact == null) {
throw new ApiException("Missing the required parameter 'contact' when calling listsContactsByListIdPost(Async)");
}
// verify the required parameter 'listId' is set
if (listId == null) {
throw new ApiException("Missing the required parameter 'listId' when calling listsContactsByListIdPost(Async)");
}
com.squareup.okhttp.Call call = listsContactsByListIdPostCall(contact, listId, progressListener, progressRequestListener);
return call;
}
/**
* Create new contact
* Create new contact
* @param contact Contact model (required)
* @param listId List id (required)
* @return String
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public String listsContactsByListIdPost(Contact contact, Integer listId) throws ApiException {
ApiResponse resp = listsContactsByListIdPostWithHttpInfo(contact, listId);
return resp.getData();
}
/**
* Create new contact
* Create new contact
* @param contact Contact model (required)
* @param listId List id (required)
* @return ApiResponse<String>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse listsContactsByListIdPostWithHttpInfo(Contact contact, Integer listId) throws ApiException {
com.squareup.okhttp.Call call = listsContactsByListIdPostValidateBeforeCall(contact, listId, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Create new contact (asynchronously)
* Create new contact
* @param contact Contact model (required)
* @param listId List 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 listsContactsByListIdPostAsync(Contact contact, Integer listId, 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 = listsContactsByListIdPostValidateBeforeCall(contact, listId, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for listsRemoveOptedOutContactsByListIdAndOptOutListIdPut
* @param listId Your list id (required)
* @param optOutListId Your opt out list 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 listsRemoveOptedOutContactsByListIdAndOptOutListIdPutCall(Integer listId, Integer optOutListId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/lists/{list_id}/remove-opted-out-contacts/{opt_out_list_id}"
.replaceAll("\\{" + "list_id" + "\\}", apiClient.escapeString(listId.toString()))
.replaceAll("\\{" + "opt_out_list_id" + "\\}", apiClient.escapeString(optOutListId.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[] { "BasicAuth" };
return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call listsRemoveOptedOutContactsByListIdAndOptOutListIdPutValidateBeforeCall(Integer listId, Integer optOutListId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'listId' is set
if (listId == null) {
throw new ApiException("Missing the required parameter 'listId' when calling listsRemoveOptedOutContactsByListIdAndOptOutListIdPut(Async)");
}
// verify the required parameter 'optOutListId' is set
if (optOutListId == null) {
throw new ApiException("Missing the required parameter 'optOutListId' when calling listsRemoveOptedOutContactsByListIdAndOptOutListIdPut(Async)");
}
com.squareup.okhttp.Call call = listsRemoveOptedOutContactsByListIdAndOptOutListIdPutCall(listId, optOutListId, progressListener, progressRequestListener);
return call;
}
/**
* Remove all opted out contacts
* Remove all opted out contacts
* @param listId Your list id (required)
* @param optOutListId Your opt out list id (required)
* @return String
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public String listsRemoveOptedOutContactsByListIdAndOptOutListIdPut(Integer listId, Integer optOutListId) throws ApiException {
ApiResponse resp = listsRemoveOptedOutContactsByListIdAndOptOutListIdPutWithHttpInfo(listId, optOutListId);
return resp.getData();
}
/**
* Remove all opted out contacts
* Remove all opted out contacts
* @param listId Your list id (required)
* @param optOutListId Your opt out list id (required)
* @return ApiResponse<String>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse listsRemoveOptedOutContactsByListIdAndOptOutListIdPutWithHttpInfo(Integer listId, Integer optOutListId) throws ApiException {
com.squareup.okhttp.Call call = listsRemoveOptedOutContactsByListIdAndOptOutListIdPutValidateBeforeCall(listId, optOutListId, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Remove all opted out contacts (asynchronously)
* Remove all opted out contacts
* @param listId Your list id (required)
* @param optOutListId Your opt out list 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 listsRemoveOptedOutContactsByListIdAndOptOutListIdPutAsync(Integer listId, Integer optOutListId, 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 = listsRemoveOptedOutContactsByListIdAndOptOutListIdPutValidateBeforeCall(listId, optOutListId, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for listsTransferContactPut
* @param fromListId List ID for list that contains contact. (required)
* @param contactId Contact ID (required)
* @param toListId List ID for list you want to transfer contact to. (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 listsTransferContactPutCall(Integer fromListId, Integer contactId, Integer toListId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/lists/{from_list_id}/contacts/{contact_id}/transfer/{to_list_id}"
.replaceAll("\\{" + "from_list_id" + "\\}", apiClient.escapeString(fromListId.toString()))
.replaceAll("\\{" + "contact_id" + "\\}", apiClient.escapeString(contactId.toString()))
.replaceAll("\\{" + "to_list_id" + "\\}", apiClient.escapeString(toListId.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[] { "BasicAuth" };
return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call listsTransferContactPutValidateBeforeCall(Integer fromListId, Integer contactId, Integer toListId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'fromListId' is set
if (fromListId == null) {
throw new ApiException("Missing the required parameter 'fromListId' when calling listsTransferContactPut(Async)");
}
// verify the required parameter 'contactId' is set
if (contactId == null) {
throw new ApiException("Missing the required parameter 'contactId' when calling listsTransferContactPut(Async)");
}
// verify the required parameter 'toListId' is set
if (toListId == null) {
throw new ApiException("Missing the required parameter 'toListId' when calling listsTransferContactPut(Async)");
}
com.squareup.okhttp.Call call = listsTransferContactPutCall(fromListId, contactId, toListId, progressListener, progressRequestListener);
return call;
}
/**
* Transfer contact to another list
* Transfer contact to another list
* @param fromListId List ID for list that contains contact. (required)
* @param contactId Contact ID (required)
* @param toListId List ID for list you want to transfer contact to. (required)
* @return String
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public String listsTransferContactPut(Integer fromListId, Integer contactId, Integer toListId) throws ApiException {
ApiResponse resp = listsTransferContactPutWithHttpInfo(fromListId, contactId, toListId);
return resp.getData();
}
/**
* Transfer contact to another list
* Transfer contact to another list
* @param fromListId List ID for list that contains contact. (required)
* @param contactId Contact ID (required)
* @param toListId List ID for list you want to transfer contact to. (required)
* @return ApiResponse<String>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse listsTransferContactPutWithHttpInfo(Integer fromListId, Integer contactId, Integer toListId) throws ApiException {
com.squareup.okhttp.Call call = listsTransferContactPutValidateBeforeCall(fromListId, contactId, toListId, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Transfer contact to another list (asynchronously)
* Transfer contact to another list
* @param fromListId List ID for list that contains contact. (required)
* @param contactId Contact ID (required)
* @param toListId List ID for list you want to transfer contact to. (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 listsTransferContactPutAsync(Integer fromListId, Integer contactId, Integer toListId, 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 = listsTransferContactPutValidateBeforeCall(fromListId, contactId, toListId, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
}