sibApi.SmsCampaignsApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sib-api-v3-sdk Show documentation
Show all versions of sib-api-v3-sdk Show documentation
SendinBlue's API v3 Java Library
The newest version!
/*
* SendinBlue API
* SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
*
* OpenAPI spec version: 3.0.0
* 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 sibApi;
import okhttp3.Call;
import sendinblue.ApiCallback;
import sendinblue.ApiClient;
import sendinblue.ApiException;
import sendinblue.ApiResponse;
import sendinblue.Configuration;
import sendinblue.Pair;
import sendinblue.ProgressRequestBody;
import sendinblue.ProgressResponseBody;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import sibModel.CreateModel;
import sibModel.CreateSmsCampaign;
import sibModel.CreatedProcessId;
import sibModel.ErrorModel;
import sibModel.GetSmsCampaign;
import sibModel.GetSmsCampaigns;
import sibModel.PostSendSmsTestFailed;
import sibModel.RequestSmsRecipientExport;
import sibModel.SendReport;
import sibModel.SendTestSms;
import sibModel.UpdateCampaignStatus;
import sibModel.UpdateSmsCampaign;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class SmsCampaignsApi {
private ApiClient apiClient;
public SmsCampaignsApi() {
this(Configuration.getDefaultApiClient());
}
public SmsCampaignsApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Build call for createSmsCampaign
* @param createSmsCampaign Values to create an SMS Campaign (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 Call createSmsCampaignCall(CreateSmsCampaign createSmsCampaign, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = createSmsCampaign;
// create path and map variables
String localVarPath = "/smsCampaigns";
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 okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "api-key", "partner-key" };
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private Call createSmsCampaignValidateBeforeCall(CreateSmsCampaign createSmsCampaign, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'createSmsCampaign' is set
if (createSmsCampaign == null) {
throw new ApiException("Missing the required parameter 'createSmsCampaign' when calling createSmsCampaign(Async)");
}
Call call = createSmsCampaignCall(createSmsCampaign, progressListener, progressRequestListener);
return call;
}
/**
* Creates an SMS campaign
*
* @param createSmsCampaign Values to create an SMS Campaign (required)
* @return CreateModel
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public CreateModel createSmsCampaign(CreateSmsCampaign createSmsCampaign) throws ApiException {
ApiResponse resp = createSmsCampaignWithHttpInfo(createSmsCampaign);
return resp.getData();
}
/**
* Creates an SMS campaign
*
* @param createSmsCampaign Values to create an SMS Campaign (required)
* @return ApiResponse<CreateModel>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse createSmsCampaignWithHttpInfo(CreateSmsCampaign createSmsCampaign) throws ApiException {
Call call = createSmsCampaignValidateBeforeCall(createSmsCampaign, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Creates an SMS campaign (asynchronously)
*
* @param createSmsCampaign Values to create an SMS Campaign (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 Call createSmsCampaignAsync(CreateSmsCampaign createSmsCampaign, 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);
}
};
}
Call call = createSmsCampaignValidateBeforeCall(createSmsCampaign, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for deleteSmsCampaign
* @param campaignId id of the SMS campaign (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 Call deleteSmsCampaignCall(Long campaignId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/smsCampaigns/{campaignId}"
.replaceAll("\\{" + "campaignId" + "\\}", apiClient.escapeString(campaignId.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 okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "api-key", "partner-key" };
return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private Call deleteSmsCampaignValidateBeforeCall(Long campaignId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'campaignId' is set
if (campaignId == null) {
throw new ApiException("Missing the required parameter 'campaignId' when calling deleteSmsCampaign(Async)");
}
Call call = deleteSmsCampaignCall(campaignId, progressListener, progressRequestListener);
return call;
}
/**
* Delete an SMS campaign
*
* @param campaignId id of the SMS campaign (required)
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void deleteSmsCampaign(Long campaignId) throws ApiException {
deleteSmsCampaignWithHttpInfo(campaignId);
}
/**
* Delete an SMS campaign
*
* @param campaignId id of the SMS campaign (required)
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse deleteSmsCampaignWithHttpInfo(Long campaignId) throws ApiException {
Call call = deleteSmsCampaignValidateBeforeCall(campaignId, null, null);
return apiClient.execute(call);
}
/**
* Delete an SMS campaign (asynchronously)
*
* @param campaignId id of the SMS campaign (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 Call deleteSmsCampaignAsync(Long campaignId, 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);
}
};
}
Call call = deleteSmsCampaignValidateBeforeCall(campaignId, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback);
return call;
}
/**
* Build call for getSmsCampaign
* @param campaignId id of the SMS campaign (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 Call getSmsCampaignCall(Long campaignId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/smsCampaigns/{campaignId}"
.replaceAll("\\{" + "campaignId" + "\\}", apiClient.escapeString(campaignId.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 okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "api-key", "partner-key" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private Call getSmsCampaignValidateBeforeCall(Long campaignId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'campaignId' is set
if (campaignId == null) {
throw new ApiException("Missing the required parameter 'campaignId' when calling getSmsCampaign(Async)");
}
Call call = getSmsCampaignCall(campaignId, progressListener, progressRequestListener);
return call;
}
/**
* Get an SMS campaign
*
* @param campaignId id of the SMS campaign (required)
* @return GetSmsCampaign
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public GetSmsCampaign getSmsCampaign(Long campaignId) throws ApiException {
ApiResponse resp = getSmsCampaignWithHttpInfo(campaignId);
return resp.getData();
}
/**
* Get an SMS campaign
*
* @param campaignId id of the SMS campaign (required)
* @return ApiResponse<GetSmsCampaign>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getSmsCampaignWithHttpInfo(Long campaignId) throws ApiException {
Call call = getSmsCampaignValidateBeforeCall(campaignId, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get an SMS campaign (asynchronously)
*
* @param campaignId id of the SMS campaign (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 Call getSmsCampaignAsync(Long campaignId, 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);
}
};
}
Call call = getSmsCampaignValidateBeforeCall(campaignId, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getSmsCampaigns
* @param status Status of campaign. (optional)
* @param startDate Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional)
* @param endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional)
* @param limit Number limitation for the result returned (optional, default to 500)
* @param offset Beginning point in the list to retrieve from. (optional, default to 0)
* @param sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public Call getSmsCampaignsCall(String status, String startDate, String endDate, Long limit, Long offset, String sort, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/smsCampaigns";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (status != null)
localVarQueryParams.addAll(apiClient.parameterToPair("status", status));
if (startDate != null)
localVarQueryParams.addAll(apiClient.parameterToPair("startDate", startDate));
if (endDate != null)
localVarQueryParams.addAll(apiClient.parameterToPair("endDate", endDate));
if (limit != null)
localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit));
if (offset != null)
localVarQueryParams.addAll(apiClient.parameterToPair("offset", offset));
if (sort != null)
localVarQueryParams.addAll(apiClient.parameterToPair("sort", sort));
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 okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "api-key", "partner-key" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private Call getSmsCampaignsValidateBeforeCall(String status, String startDate, String endDate, Long limit, Long offset, String sort, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Call call = getSmsCampaignsCall(status, startDate, endDate, limit, offset, sort, progressListener, progressRequestListener);
return call;
}
/**
* Returns the information for all your created SMS campaigns
*
* @param status Status of campaign. (optional)
* @param startDate Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional)
* @param endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional)
* @param limit Number limitation for the result returned (optional, default to 500)
* @param offset Beginning point in the list to retrieve from. (optional, default to 0)
* @param sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc)
* @return GetSmsCampaigns
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public GetSmsCampaigns getSmsCampaigns(String status, String startDate, String endDate, Long limit, Long offset, String sort) throws ApiException {
ApiResponse resp = getSmsCampaignsWithHttpInfo(status, startDate, endDate, limit, offset, sort);
return resp.getData();
}
/**
* Returns the information for all your created SMS campaigns
*
* @param status Status of campaign. (optional)
* @param startDate Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional)
* @param endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional)
* @param limit Number limitation for the result returned (optional, default to 500)
* @param offset Beginning point in the list to retrieve from. (optional, default to 0)
* @param sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc)
* @return ApiResponse<GetSmsCampaigns>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getSmsCampaignsWithHttpInfo(String status, String startDate, String endDate, Long limit, Long offset, String sort) throws ApiException {
Call call = getSmsCampaignsValidateBeforeCall(status, startDate, endDate, limit, offset, sort, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Returns the information for all your created SMS campaigns (asynchronously)
*
* @param status Status of campaign. (optional)
* @param startDate Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional)
* @param endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' ) (optional)
* @param limit Number limitation for the result returned (optional, default to 500)
* @param offset Beginning point in the list to retrieve from. (optional, default to 0)
* @param sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (optional, default to desc)
* @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 Call getSmsCampaignsAsync(String status, String startDate, String endDate, Long limit, Long offset, String sort, 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);
}
};
}
Call call = getSmsCampaignsValidateBeforeCall(status, startDate, endDate, limit, offset, sort, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for requestSmsRecipientExport
* @param campaignId id of the campaign (required)
* @param recipientExport Values to send for a recipient export request (optional)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public Call requestSmsRecipientExportCall(Long campaignId, RequestSmsRecipientExport recipientExport, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = recipientExport;
// create path and map variables
String localVarPath = "/smsCampaigns/{campaignId}/exportRecipients"
.replaceAll("\\{" + "campaignId" + "\\}", apiClient.escapeString(campaignId.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 okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "api-key", "partner-key" };
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private Call requestSmsRecipientExportValidateBeforeCall(Long campaignId, RequestSmsRecipientExport recipientExport, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'campaignId' is set
if (campaignId == null) {
throw new ApiException("Missing the required parameter 'campaignId' when calling requestSmsRecipientExport(Async)");
}
Call call = requestSmsRecipientExportCall(campaignId, recipientExport, progressListener, progressRequestListener);
return call;
}
/**
* Export an SMS campaign's recipients
* It returns the background process ID which on completion calls the notify URL that you have set in the input.
* @param campaignId id of the campaign (required)
* @param recipientExport Values to send for a recipient export request (optional)
* @return CreatedProcessId
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public CreatedProcessId requestSmsRecipientExport(Long campaignId, RequestSmsRecipientExport recipientExport) throws ApiException {
ApiResponse resp = requestSmsRecipientExportWithHttpInfo(campaignId, recipientExport);
return resp.getData();
}
/**
* Export an SMS campaign's recipients
* It returns the background process ID which on completion calls the notify URL that you have set in the input.
* @param campaignId id of the campaign (required)
* @param recipientExport Values to send for a recipient export request (optional)
* @return ApiResponse<CreatedProcessId>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse requestSmsRecipientExportWithHttpInfo(Long campaignId, RequestSmsRecipientExport recipientExport) throws ApiException {
Call call = requestSmsRecipientExportValidateBeforeCall(campaignId, recipientExport, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Export an SMS campaign's recipients (asynchronously)
* It returns the background process ID which on completion calls the notify URL that you have set in the input.
* @param campaignId id of the campaign (required)
* @param recipientExport Values to send for a recipient export request (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 Call requestSmsRecipientExportAsync(Long campaignId, RequestSmsRecipientExport recipientExport, 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);
}
};
}
Call call = requestSmsRecipientExportValidateBeforeCall(campaignId, recipientExport, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for sendSmsCampaignNow
* @param campaignId id of the campaign (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 Call sendSmsCampaignNowCall(Long campaignId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/smsCampaigns/{campaignId}/sendNow"
.replaceAll("\\{" + "campaignId" + "\\}", apiClient.escapeString(campaignId.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 okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "api-key", "partner-key" };
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private Call sendSmsCampaignNowValidateBeforeCall(Long campaignId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'campaignId' is set
if (campaignId == null) {
throw new ApiException("Missing the required parameter 'campaignId' when calling sendSmsCampaignNow(Async)");
}
Call call = sendSmsCampaignNowCall(campaignId, progressListener, progressRequestListener);
return call;
}
/**
* Send your SMS campaign immediately
*
* @param campaignId id of the campaign (required)
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void sendSmsCampaignNow(Long campaignId) throws ApiException {
sendSmsCampaignNowWithHttpInfo(campaignId);
}
/**
* Send your SMS campaign immediately
*
* @param campaignId id of the campaign (required)
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse sendSmsCampaignNowWithHttpInfo(Long campaignId) throws ApiException {
Call call = sendSmsCampaignNowValidateBeforeCall(campaignId, null, null);
return apiClient.execute(call);
}
/**
* Send your SMS campaign immediately (asynchronously)
*
* @param campaignId id of the campaign (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 Call sendSmsCampaignNowAsync(Long campaignId, 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);
}
};
}
Call call = sendSmsCampaignNowValidateBeforeCall(campaignId, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback);
return call;
}
/**
* Build call for sendSmsReport
* @param campaignId id of the campaign (required)
* @param sendReport Values for send a report (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 Call sendSmsReportCall(Long campaignId, SendReport sendReport, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = sendReport;
// create path and map variables
String localVarPath = "/smsCampaigns/{campaignId}/sendReport"
.replaceAll("\\{" + "campaignId" + "\\}", apiClient.escapeString(campaignId.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 okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "api-key", "partner-key" };
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private Call sendSmsReportValidateBeforeCall(Long campaignId, SendReport sendReport, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'campaignId' is set
if (campaignId == null) {
throw new ApiException("Missing the required parameter 'campaignId' when calling sendSmsReport(Async)");
}
// verify the required parameter 'sendReport' is set
if (sendReport == null) {
throw new ApiException("Missing the required parameter 'sendReport' when calling sendSmsReport(Async)");
}
Call call = sendSmsReportCall(campaignId, sendReport, progressListener, progressRequestListener);
return call;
}
/**
* Send an SMS campaign's report
* Send report of Sent and Archived campaign, to the specified email addresses, with respective data and a pdf attachment in detail.
* @param campaignId id of the campaign (required)
* @param sendReport Values for send a report (required)
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void sendSmsReport(Long campaignId, SendReport sendReport) throws ApiException {
sendSmsReportWithHttpInfo(campaignId, sendReport);
}
/**
* Send an SMS campaign's report
* Send report of Sent and Archived campaign, to the specified email addresses, with respective data and a pdf attachment in detail.
* @param campaignId id of the campaign (required)
* @param sendReport Values for send a report (required)
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse sendSmsReportWithHttpInfo(Long campaignId, SendReport sendReport) throws ApiException {
Call call = sendSmsReportValidateBeforeCall(campaignId, sendReport, null, null);
return apiClient.execute(call);
}
/**
* Send an SMS campaign's report (asynchronously)
* Send report of Sent and Archived campaign, to the specified email addresses, with respective data and a pdf attachment in detail.
* @param campaignId id of the campaign (required)
* @param sendReport Values for send a report (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 Call sendSmsReportAsync(Long campaignId, SendReport sendReport, 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);
}
};
}
Call call = sendSmsReportValidateBeforeCall(campaignId, sendReport, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback);
return call;
}
/**
* Build call for sendTestSms
* @param campaignId Id of the SMS campaign (required)
* @param phoneNumber Mobile number of the recipient with the country code. This number must belong to one of your contacts in SendinBlue account and must not be blacklisted (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 Call sendTestSmsCall(Long campaignId, SendTestSms phoneNumber, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = phoneNumber;
// create path and map variables
String localVarPath = "/smsCampaigns/{campaignId}/sendTest"
.replaceAll("\\{" + "campaignId" + "\\}", apiClient.escapeString(campaignId.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 okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "api-key", "partner-key" };
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private Call sendTestSmsValidateBeforeCall(Long campaignId, SendTestSms phoneNumber, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'campaignId' is set
if (campaignId == null) {
throw new ApiException("Missing the required parameter 'campaignId' when calling sendTestSms(Async)");
}
// verify the required parameter 'phoneNumber' is set
if (phoneNumber == null) {
throw new ApiException("Missing the required parameter 'phoneNumber' when calling sendTestSms(Async)");
}
Call call = sendTestSmsCall(campaignId, phoneNumber, progressListener, progressRequestListener);
return call;
}
/**
* Send a test SMS campaign
*
* @param campaignId Id of the SMS campaign (required)
* @param phoneNumber Mobile number of the recipient with the country code. This number must belong to one of your contacts in SendinBlue account and must not be blacklisted (required)
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void sendTestSms(Long campaignId, SendTestSms phoneNumber) throws ApiException {
sendTestSmsWithHttpInfo(campaignId, phoneNumber);
}
/**
* Send a test SMS campaign
*
* @param campaignId Id of the SMS campaign (required)
* @param phoneNumber Mobile number of the recipient with the country code. This number must belong to one of your contacts in SendinBlue account and must not be blacklisted (required)
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse sendTestSmsWithHttpInfo(Long campaignId, SendTestSms phoneNumber) throws ApiException {
Call call = sendTestSmsValidateBeforeCall(campaignId, phoneNumber, null, null);
return apiClient.execute(call);
}
/**
* Send a test SMS campaign (asynchronously)
*
* @param campaignId Id of the SMS campaign (required)
* @param phoneNumber Mobile number of the recipient with the country code. This number must belong to one of your contacts in SendinBlue account and must not be blacklisted (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 Call sendTestSmsAsync(Long campaignId, SendTestSms phoneNumber, 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);
}
};
}
Call call = sendTestSmsValidateBeforeCall(campaignId, phoneNumber, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback);
return call;
}
/**
* Build call for updateSmsCampaign
* @param campaignId id of the SMS campaign (required)
* @param updateSmsCampaign Values to update an SMS Campaign (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 Call updateSmsCampaignCall(Long campaignId, UpdateSmsCampaign updateSmsCampaign, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = updateSmsCampaign;
// create path and map variables
String localVarPath = "/smsCampaigns/{campaignId}"
.replaceAll("\\{" + "campaignId" + "\\}", apiClient.escapeString(campaignId.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 okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "api-key", "partner-key" };
return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private Call updateSmsCampaignValidateBeforeCall(Long campaignId, UpdateSmsCampaign updateSmsCampaign, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'campaignId' is set
if (campaignId == null) {
throw new ApiException("Missing the required parameter 'campaignId' when calling updateSmsCampaign(Async)");
}
// verify the required parameter 'updateSmsCampaign' is set
if (updateSmsCampaign == null) {
throw new ApiException("Missing the required parameter 'updateSmsCampaign' when calling updateSmsCampaign(Async)");
}
Call call = updateSmsCampaignCall(campaignId, updateSmsCampaign, progressListener, progressRequestListener);
return call;
}
/**
* Update an SMS campaign
*
* @param campaignId id of the SMS campaign (required)
* @param updateSmsCampaign Values to update an SMS Campaign (required)
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void updateSmsCampaign(Long campaignId, UpdateSmsCampaign updateSmsCampaign) throws ApiException {
updateSmsCampaignWithHttpInfo(campaignId, updateSmsCampaign);
}
/**
* Update an SMS campaign
*
* @param campaignId id of the SMS campaign (required)
* @param updateSmsCampaign Values to update an SMS Campaign (required)
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse updateSmsCampaignWithHttpInfo(Long campaignId, UpdateSmsCampaign updateSmsCampaign) throws ApiException {
Call call = updateSmsCampaignValidateBeforeCall(campaignId, updateSmsCampaign, null, null);
return apiClient.execute(call);
}
/**
* Update an SMS campaign (asynchronously)
*
* @param campaignId id of the SMS campaign (required)
* @param updateSmsCampaign Values to update an SMS Campaign (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 Call updateSmsCampaignAsync(Long campaignId, UpdateSmsCampaign updateSmsCampaign, 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);
}
};
}
Call call = updateSmsCampaignValidateBeforeCall(campaignId, updateSmsCampaign, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback);
return call;
}
/**
* Build call for updateSmsCampaignStatus
* @param campaignId id of the campaign (required)
* @param status Status of the campaign. (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 Call updateSmsCampaignStatusCall(Long campaignId, UpdateCampaignStatus status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = status;
// create path and map variables
String localVarPath = "/smsCampaigns/{campaignId}/status"
.replaceAll("\\{" + "campaignId" + "\\}", apiClient.escapeString(campaignId.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 okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { "api-key", "partner-key" };
return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private Call updateSmsCampaignStatusValidateBeforeCall(Long campaignId, UpdateCampaignStatus status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'campaignId' is set
if (campaignId == null) {
throw new ApiException("Missing the required parameter 'campaignId' when calling updateSmsCampaignStatus(Async)");
}
// verify the required parameter 'status' is set
if (status == null) {
throw new ApiException("Missing the required parameter 'status' when calling updateSmsCampaignStatus(Async)");
}
Call call = updateSmsCampaignStatusCall(campaignId, status, progressListener, progressRequestListener);
return call;
}
/**
* Update a campaign's status
*
* @param campaignId id of the campaign (required)
* @param status Status of the campaign. (required)
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void updateSmsCampaignStatus(Long campaignId, UpdateCampaignStatus status) throws ApiException {
updateSmsCampaignStatusWithHttpInfo(campaignId, status);
}
/**
* Update a campaign's status
*
* @param campaignId id of the campaign (required)
* @param status Status of the campaign. (required)
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse updateSmsCampaignStatusWithHttpInfo(Long campaignId, UpdateCampaignStatus status) throws ApiException {
Call call = updateSmsCampaignStatusValidateBeforeCall(campaignId, status, null, null);
return apiClient.execute(call);
}
/**
* Update a campaign's status (asynchronously)
*
* @param campaignId id of the campaign (required)
* @param status Status of the campaign. (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 Call updateSmsCampaignStatusAsync(Long campaignId, UpdateCampaignStatus status, 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);
}
};
}
Call call = updateSmsCampaignStatusValidateBeforeCall(campaignId, status, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback);
return call;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy